query function for number of arguments



On 4/30/10 5:57 AM, John Lapeyre wrote:
> On Friday 30 April 2010 03:29:26 Raymond Toy wrote:
>   
>> There's function-lambda-expression, but it could return NIL.
>>     
>  That looks like the best I can do.
>
>   
>> This seems like a strange question.  You want to call some Lisp
>> function, but you don't know how many arguments it has?  Then why are
>> you calling that function to begin with?
>>     
>  
>  It comes up in the Mathematica to Macsyma translator. For instance, in Mma
>   
>   Mod[10,6]
>   4
>
>   Mod[10,6,1] --> error, too many arguments
>
>   Apply[Mod[#1,#2]&, {10,6,1}]
>   4
>
>   But the Macsyma translation fails when called:
>   Apply(lambda( [arg1,arg2], Mod(arg1,arg2) ),[10,6,1]);
>   
Maybe this will work:

Apply(lambda([arg1, arg2, [more]], Mod(arg1, arg2)), [10,6,1])

Ray