On 11/1/07, Jaime Villate <villate at fe.up.pt> wrote:
> What am I doing wrong here? Why mfuncall is not using the redefined
> function?
>
> (%i10) gnuplot_color(x):= [8,5,6][x]$
> (%i11) gnuplot_color(1);
> (%o11) 8
> (%i12) :lisp (mfuncall '$gnuplot_color 1);
> 3
Oh, rats --- I guess MFUNCALL doesn't look for a Maxima definition
before a Lisp definition .... MAPPLY1 doesn't either.
Try (MEVAL `(($GNUPLOT_COLOR) ,C)) instead, where C is a variable
that has the color index. Or you can define gnuplot_color as a Maxima
function to being with, via (MEVAL '(($DEFINE) (($GNUPLOT_COLOR) C) ...)).
There seems to be some inconsistency here -- map and apply
(which call MAPPLY1) don't have the same effect as evaluating
a function call in the interpreter. What I mean is that
map(gnuplot_color, [2]) and apply(gnuplot_color, [2]) yield
something different than gnuplot_color(2). It seems like they
should all invoke the same function definition.
FWIW
Robert