plot2d (?) error



On Tue, Dec 2, 2008 at 10:51 AM, Robert Dodier <robert.dodier at gmail.com>wrote:

> On 12/1/08, Adam Majewski <adammaj1 at o2.pl> wrote:
>
> >  How to pass external function thru parameters ?
> >  ( here f is global function )
>
> I guess what you have observed is that with the function
> definition foo(f) := f(whatever), the function call foo(g) calls f
> when there exists a function named f, but calls g otherwise.
> This is a bug IMNSHO.
>

This is not a bug.  It is a correct implementation of standard Lisp
semantics starting with Lisp 1.5, through MacLisp (which Macsyma was
originally implemented on and whose semantics Macsyma/Maxima copied) and
into early Common Lisp.  See
http://www.nhplace.com/kent/Papers/Technical-Issues.html for discussion.

That said, I agree that it is confusing to users and could be revisited.
The two usual ways of handling this are:

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]).

Both have advantages and disadvantages.

            -s