Strange behavior: uppercase/lowercase



Dear all,

I have started to do a feasibility study along the line with what
Raymond Toy san has suggested, namely the use of maxima-user
package to solve this issue (recorded as bug No. 530030).

Attached is a short lisp program which implements suggested
maxima-user package system and a simplified maxima top level
to see if it works at least theoretically.

If this way looks good for other people, too, then I will start to design
necessary modifications to maxima.

Any comments are welcome.

Yasuaki Honda
Independent Developer,
Chiba, Japan

On 2002.03.15, at 04:02, James Amundson wrote:

> The summary given below is very good. I especially like the short
> version:
>
>> I believe this is somewhere in between a bug and spec.
>
> Exactly.
>
> I think the time has come to address this surprising behavior in Maxima.
> Suggestions are welcome. (Thank you Ray, for starting...)
>
> --Jim
>
> On Thu, 2002-03-14 at 09:05, Yasuaki Honda wrote:
>> Dear Daniel,
>>
>> I believe this is somewhere in between a bug and spec.
>>
>> In the Maxima manual "Lisp and Maxima" it says:
>>
>> "If you intend to write lisp functions to be called at macsyma level 
>> you
>> should name them by names beginning with a "$". Note that all symbols
>> typed at lisp level are automatically read in upper case, unless you do
>> something like |$odeSolve| to force the case to be respected. Maxima
>> interprets symbols as mixed case, if the symbol has already been read
>> before or at the time it was first read there was not an already
>> existing symbol with the same letters but upper case only. Thus if you
>> type
>>
>>
>> (C1) Integrate;
>> (D1) INTEGRATE
>> (C2) Integ;
>> (D2) Integ
>>
>>
>> The symbol Integrate already existed in upper case since it is a Maxima
>> primitive, but INTEG, does not already exist, so the Integ is 
>> permitted.
>> This may seem a little bizarre, but we wish to keep old maxima code
>> working, which assumes that Maxima primitives may be in upper or lower
>> case. An advantage of this system is that if you type in lower case, 
>> you
>> will immediately see which are the maxima keywords and functions. "
>>
>> So, in your example, y1 is regarded as a Maxima primitive while y0 is
>> not. How this happens?
>> The answer is also in the above quote. A lisp symbol $Y1 is already 
>> read
>> before Maxima starts
>> the command line input, while $Y0 is never read before. If you take a
>> look at line 853 of ode2.lisp,
>> lisp symbols such as $Y1, $Y2, $Y3, $Y4, $WR, $HEURISTIC, $%K1, $%K2 
>> are
>> used. This is where
>> these symbols are read (or interned, in the lisp language term).
>>
>> You may try:
>> (C11) [y0, y1, y2, y3, y4, y5];
>> (D11)                      [y0, Y1, Y2, Y3, Y4, y5]
>>
>> This is exactly the behavior specified in the manual as quoted above. 
>> So
>> someone may call
>> it a part of the spec. At the same time, any of y0 through y5 cannot be
>> regarded as Maxima
>> primitives. So someone may call it a bug.
>>
>> The logic above is implemented by the lisp function bothcase-implode
>> defined in commac.lisp.
>>
>> Yasuaki Honda
>> Independent Developer,
>> Chiba, Japan
>>
>> On 2002.03.13, at 09:00, Daniel Lemire wrote:
>>
>>> From a recent CVS build:
>>>
>>> (C5) [y0,y1];
>>>
>>> (D5)                               [y0, Y1]
>>>
>>>
>>> _______________________________________________
>>> Maxima mailing list
>>> Maxima@www.math.utexas.edu
>>> http://www.math.utexas.edu/mailman/listinfo/maxima

Attached file: maxima-user-package.lisp