Extending maxima language



On 1/7/07, Andrej Vodopivec <andrej.vodopivec at gmail.com> wrote:
> 1) cond statement (with whatever syntax)

Maxima already has a cond statement:

        if a then b
        elseif c then d
        ...  (any number of elseif clauses)
        else e  (optional)

The final "else" clause is exactly equivalent to

        elseif true then e

The only difference with Lisp's cond statement is that the
then-clauses contain only a single statement since there is no
explicit syntactic bracketing: you could I suppose interpret
        if a then b, c elseif ...
as
        if a then (b,c) elseif ...
but how would you interpret
        if a then b, c
?

If you want syntax that's completely parallel to Lisp cond, just
always use the parens:

        if a then (b)
        elseif c then (d)
        ...  (any number of elseif clauses)
        else (e)  (optional)

which allows you to have multiple comma-separated statements in the
then-clauses.

              -s