Incorrect.  This behaviour is due to the reader eagerly giving preference to 
numbers; symbols can contain any characters, and are unrelated to the JVM:

=> '1st
#<NumberFormatException java.lang.NumberFormatException: Invalid number: 1st>
=> (symbol "1st")
1st
=> (symbol "foo bar")
foo bar

Of course, such symbols cannot be readably printed, which is a separate issue.  
Some have suggested that symbols should be printed (and therefore readable) 
using the pipe syntax found in other lisps (e.g. |foo bar|); I thought there 
was an issue open for this in JIRA, but I can't find it at the moment.

- Chas

On Mar 28, 2011, at 6:02 AM, Nick Zbinden wrote:

> Yes, I think thats a naming restriction by the JVM.
> 
> On Mar 28, 11:57 am, Fred Concklin <[email protected]> wrote:
>> in common lisp:> (setf x '((1st element) 2 (element 3) ((4)) 5))
>> 
>> ((1ST ELEMENT) 2 (ELEMENT 3) ((4)) 5)
>> 
>> in clojure:
>> user> (def x '((1st element) 2 (element 3) ((4)) 5))
>> java.lang.NumberFormatException: Invalid number: 1st
>>   [Thrown class clojure.lang.LispReader$ReaderException]
>> 
>> Looking into it
>> 
>> user> '1s
>> java.lang.NumberFormatException: Invalid number: 1s
>>   [Thrown class clojure.lang.LispReader$ReaderException]
>> 
>> user> 's1
>> s1
>> 
>> Is that intentional? I'm using 1.2
>> 
>> fpc
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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

Reply via email to