Subject: keyword names that can't be set in maxima
From: Stavros Macrakis
Date: Fri, 16 Feb 2007 11:44:23 -0500
On 2/16/07, Richard Fateman <fateman at cs.berkeley.edu> wrote:
>
> I would find it handy if I could declare certain names to be not
> settable....
Previous suggestion for keyword-based arguments like this:
>
> Gaussianint(fun, limits=[0,inf]);
>
> If limits were declared to be a keyword symbolic constant, it would
> prevent
> someone from setting it, e.g. limits:hahaha, or limits:points, and
> messing
> up the call.
>
> Comments?
>
I think it would be a pity to start "locking up" all sorts of symbols as
keywords. There are several other ways to handle this:
-- insist that the user use the quotation mark in these cases: 'limit=...
Disadvantage: everywhere else in Maxima, 'foo and foo evaluate to the same
thing if foo is unassigned, and users have gotten into the bad habit of
dropping quotation marks (until it bites them in cases like
map(gcd,[3,4],[6,26]) )
-- use special syntax for keywords. This is familiar from both Lisp and
newer scripting languages. Of course we can't use :keyword, because ":"
already means something, but there are other possibilities. (I suppose we
could use unary prefix colon if it always appears in syntactic contexts like
(:foo=3, :bar=3), but that doesn't sound appealing)
-- use a special operator for keywords which doesn't evaluate its first
argument, e.g. (foo => 23), where => doesn't evaluate foo. Disadvantage: if
we start using => notation for maps in general, ev doesn't work any more.
e.g. mymap:{ a=>2, b=>3}, ev(mymap, a=x,b=y) doesn't work, though of course
subst does.
-s