On Fri, Apr 30, 2010 at 05:57, John Lapeyre <pdl at johnlapeyre.com> wrote:
> ...But the Macsyma translation fails when called:
> Apply(lambda( [arg1,arg2], Mod(arg1,arg2) ),[10,6,1]);
>
Well, it *should* fail, shouldn't it? If you call a function incorrectly,
you get an error. Seems like the correct behavior to me.
Compare the simple case below:
(%i9) f():= lambda([a],a)();
(%o9) f() :=
lambda([a], a)()
(%i10) f();
Too few arguments supplied to lambda([a], a)(a); found: []
#0: f()
-- an error. To debug this try: debugmode(true);
-------------When interpreted, f gives a run-time error -- good!
--------------------
(%i11) translate(f);
(%o11) [f]
(%i12) f();
Maxima encountered a Lisp error:
Error in LISP:LAMBDA-CLOSURE [or a callee]: LISP:LAMBDA-CLOSURE [or a
callee] requires more than zero arguments.
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
-------------When translated, f gives a run-time error -- would have been
better to give a translate-time error. --------------------
(%i13) compile(f);
Compiling C:/DOCUME~1/SMACRA~1/LOCALS~1/Temp/gazonk_8368_0.lsp.
End of Pass 1.
; (DEFUN $F) is being compiled.
;;; Calling lambda with 0 args not 1
No FASL generated.
Maxima encountered a Lisp error:
Error in LET [or a callee]: Cannot open the file NIL..
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
-------------When compiled, f gives a compile-time error -- Good!
--------------------