> >> But using symbols for something like this is a bit contrived anyway.

Yes, But sometimes it needs contrived examples to get the message.
Especially if you have misleading preconceptions. And to me, symbols
had always been a way to refer to stuff. And only that. That had to be
shaken an is now.

(Like the old hastable example: A consistent implementation is
returning a constant. Thats slow and doesnt scale, but it's
consistent. To me thats been illuminating.)

Many thanks to all for the discussion.

alux

On 18 Mrz., 23:21, Richard Newman <holyg...@gmail.com> wrote:
> >> But using symbols for something like this is a bit contrived anyway.
>
> > Maybe, but I've seen it in other Common Lisp books/tutorials before.
> > e.g. I'm sure PAIP was one of them.
>
> Part of the motivation is that CL symbols always compare with EQ and  
> EQL, whilst strings are not required to do so:
>
> cl-user(9): (eq (concatenate 'string "foo" "bar") "foobar")
> nil
>
> This means you can use nice constructs such as CASE with symbols, but  
> you need to roll your own using string-equal or string= to handle  
> strings.
>
> (Using symbols also saves you typing all those double-quote  
> characters, as well as saving memory and computation during  
> comparison: symbols are interned, unlike strings.)
>
> In Clojure (thanks to Java's immutable interned strings) strings  
> compare efficiently with = just like everything else, so there's less  
> motivation.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to