plot2d (?) error



On 12/2/08, Stavros Macrakis <macrakis at alum.mit.edu> wrote:

> Lisp-1 -- there is no such thing as a function value; all values are alike.
> In this view, f(x):=... is precisely equivalent to f : lambda([x],...) and
> f(x) is precisely equivalent to apply(f,[x]).
>
> Lisp-2 -- function values and regular values are completely different.  In
> this view, f(x):=... and f: ... do not interact at all.  If f is not defined
> as a function, f(x) is an error.  If we go this way, I would recommend that
> (f)(x) be defined as equivalent to apply(f,[x]).

These days I think I am in favor of Lisp-1 for Maxima.

About subscriptable objects. Consider:

foo (x, k) := x[k] : x[k] + 1;

At present foo treats lists and Lisp arrays (created by make_array)
differently than declared and undeclared arrays.
In the expression x[k], x is evaluated if it doesn't have a declared
or undeclared array associated with it, but otherwise x is evaluated.
I'm pretty sure we should evaluate, or not, consistently.

On the right-hand side of the assignment, always evaluating x
(if not otherwise quoted) would be consistent w/ Lisp-1. That's fine.

I wonder whether x should be evaluated on the left-hand side.
":" is advertised as quoting its left-hand side (while "::" evaluates it).
So that suggests x should not be evaluated on the left-hand side.
But then in x[k] : x[k] + 1, the right- and left-hand sides can refer to
different objects, and that would be an unpleasant surprise.
But x[k] :: x[k] + 1 isn't suitable either, since the left-hand side
can evaluate to something other than a place to store something.
Do we want to invent another assignment operator?
Or make ":" treat all subscriptable objects the way it treats lists
and Lisp arrays at present (i.e. evaluate x and k but not x[k]) ??

Opinions?

Robert Dodier