How deal list function arguments in translate and compile ?



On Wed, Jun 17, 2009 at 11:40 PM, Niitsuma
Hirotaka<hirotaka.niitsuma at gmail.com> wrote:

> % ?wf(v):=block(mode_declare(completearray(v[2] ),float),return(v[1]+v[2]))

> %translate(wf)
> %wf([1,2])
>
> Maxima encountered a Lisp error:
> EVAL: undefined function $V

> RETURN (+ ($V 1 ) ($V 2)

Hmm. Looks like a bug in the handling of the mode_declare(completearray(...)).
According to the documentation for mode_declare, you are doing the right thing.
Can you please create a bug report?
See: http://sourceforge.net/tracker/?atid=104933&group_id=4933

Try omitting the mode_declare(completearray(...)), i.e.
wf(v) := v[1] + v[2];
I think that is translated into working code.
(Note that return(...) is not needed; the return value is the value
of the last expression evaluated.)

Hope this helps,

Robert Dodier