Subject: Re: Ruby performance woes
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 25 Apr 2008 21:12:52 -0500
Newsgroups: comp.lang.lisp
Message-ID: <HLGdnfn63e45Eo_VnZ2dnUVZ_umdnZ2d@speakeasy.net>
Mark Wooding  <mdw@distorted.org.uk> wrote:
+---------------
| I agree about the unpleasantness of uppercase Lisp.  I used to set
| *PRINT-CASE* to :DOWNCASE in my various .lisprcs, but I gave up partly
| because I realized that uppercase responses disambiguated the
| implementation's output from my input in transcripts, but mostly because
| far too many add-on systems broke in unpleasant ways, usually as a
| result of saying things like (intern (format nil "FROB-~A" some-symbol))
| and then trying to use FROB-MUMBLE.
+---------------

You might try leaving *PRINT-CASE* alone and instead try changing
(READTABLE-CASE *READTABLE*) from :UPCASE to :INVERT, which both
preserves any CamelCase you might need to READ from data files and
also downcases all-uppercase symbols when printing [yes, even with
*PRINT-CASE* remaining the default :UPCASE, see CLHS 22.1.3.3.2
"Effect of Readtable Case on the Lisp Printer"]. This gives the
following behavior:

    > (loop for sym in '(foo FooBar FOO)
	collect (list sym (symbol-name sym)))
	
    ((FOO "FOO") (FOOBAR "FOOBAR") (FOO "FOO"))
    > (setf (readtable-case *readtable*) :invert)

    :invert
    > (loop for sym in '(foo FooBar FOO)
	collect (list sym (symbol-name sym)))
	
    ((foo "FOO") (FooBar "FooBar") (FOO "foo"))
    > 

Of course, it messes up your FROB example as written:

    > (intern (format nil "FROB-~A" 'quux))

    FROB-quux
    :internal
    > (symbol-name *)

    "FROB-quux"
    > 

But that can be fixed [compatibly with the defaults!] this way:

    > (intern (format nil "FROB-~A" (symbol-name 'quux)))

    frob-quux
    :internal
    > (symbol-name *)

    "FROB-QUUX"
    > 

This is arguably more nearly correct, since you shouldn't really
be concatenating a string and a symbol in the first place, but
rather two strings [which is what the "fix" does].

But I'll grant you that :INVERT *does* lose the feature you mentioned
"that uppercase responses disambiguate the implementation's output
from input in transcripts":

    cmu> (apropos 'quux)

    frob-quux
    quux
    FROB-quux
    > 

So you still may prefer to stay with the standard defaults.


-Rob

p.s. But it's really, *really* helpful when dealing
with external CamelCase input [such as EDIF files]...  ;-}  ;-}

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607