Chris Baker <[EMAIL PROTECTED]> writes:

> Common Lisp symbols are up-cased by the reader before they're
> interned, and down-cased when printed.  I'd love to explain why

It's partly for historical reasons. Early Lisps were of course
UPPERCASE ONLY, since the terminals they were used on had only the one
case. But later nice terminals came out that accepted lowercase. So
Lisps were modified to accept lowercase input but converted it into
uppercase so that output would be readable on uppercase-only terminals
as well. Common Lisp has a default case which all input is converted
into unless it's escaped (as within || or "" or by \). This is a
throwback to the monocase Lisp systems like MACLISP.

If your terminal supports only uppercase then your input is read
uppercase, and when downcased by the printer you still see
uppercase. No change to your eyes. If however your terminal is
lowercase then you input lowercase, the reader upcases it, then the
printer downcases it, so you see lowercase. No change to your
eyes. But confusing as all hell if you were expecting bicase, or some
other sort of case-preservation. Guy Steel in CLtL2 has a fair bit of
explanation for this behavior as I recall.

That's the reason my addled brain returned at the moment, but I'm
prone to some memory corruption due to illness right now.

There were monocase lowercase terminals too! But they were very
rare. IBM Selectric-based terminals could be switched simply by
changing their golf ball, but of course the computer on the end didn't
know the difference.

The UNIX login program had 'intelligence' built into it such that if
you entered your username in uppercase it would set the terminal IUCLC
bit (which used to be called something else) to uppercase only and
then properly accept your password case-insensitively. The terminal
ran in uppercase mode subsequently. The reason for this is the same as
why Lisp likes uppercase. UNIX likes lowercase because the designers
chose it instead, whereas Lisp is the other way for the opposite reason.

'james

-- 
James A. Crippen <james at unlambda.com> Lambda Unlimited
61.2204N, -149.8964W                     Recursion 'R' Us
Anchorage, Alaska, USA, Earth            Y = \f.(\x.f(xx))(\x.f(xx))

Reply via email to