Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#498 ('[a,b,c])[2] and ('v)[2]

Lisp Core (472)
Stavros Macrakis

arrayapply('[a,b],[2]) => b OK
('[a,b])[2] =>
Illegal form - SIMPLIFYA:
((((MLIST) |$a| |$b|)) 2)

cf bug 866706: ('m)[1] => m(2), not v[2]

What is going on here is that Maxima wants to treat

('f)(x) == funmake('f,[x]) == apply('('f),[x])

which I find a very poor convention, because it means
that the (...)(...) construction is non-compositional.
After all,

('f+0)(x) == apply('f,[x])

So, ... how do you explain this? Do you consider ('...)()
== ('(...))() to be a special *syntactic* construction,
even though the parser doesn't parse it into any sort of
special internal form? Yuck, yuck, yuck.

The fact that apply('('f),...) is special-cased is less
problematic, but still weird, since apply('('f+0),...) does
the same thing, though apply('(factor('fff)),[x]) gives an
error. More yuck.

Ayway it doesn't use funmake to construct the result,
so screws up the error.

I am not sure what the best fix is. I am tempted to
completely eliminate ('f)(x) and apply('('f)...) as special
cases. Then everything "just works". True, you need to
use funmake to avoid evaluating, but that should be OK.


  • Robert Dodier
    Robert Dodier

    • labels: --> Lisp Core