Yeah the latter version parses as 2 symbols in sjacket, whereas the defn 
version parses as a single list. 

user=> (p/parser "top%")
#net.cgrand.parsley.Node{:tag :net.cgrand.sjacket.parser/root, :content 
[#net.cgrand.parsley.Node{:tag :symbol, :content 
[#net.cgrand.parsley.Node{:tag :name, :content ["top"]}]} 
#net.cgrand.parsley.Node{:tag :symbol, :content 
[#net.cgrand.parsley.Node{:tag :name, :content ["%"]}]}]}

REPLy uses sjacket to split input expressions and send them each off to 
nREPL in sequence, IIRC so that you get all results back from stuff like:

user=> 1 2 3
1
2
3

So it treats the "top%" input basically the same as if there were 
intervening whitespace, like "top %".

>From http://clojure.org/reader:
-----
Symbols begin with a non-numeric character and can contain alphanumeric 
characters and *, +, !, -, _, and ? (other characters will be allowed 
eventually, but not all macro characters have been determined). '/' has 
special meaning, it can be used once in the middle of a symbol to separate 
the namespace from the name, e.g. my-namespace/foo. '/' by itself names the 
division function. '.' has special meaning - it can be used one or more 
times in the middle of a symbol to designate a fully-qualified class name, 
e.g. java.util.BitSet, or in namespace names. Symbols beginning or ending 
with '.' are reserved by Clojure. Symbols containing / or . are said to be 
'qualified'. Symbols beginning or ending with ':' are reserved by Clojure. 
A symbol can contain one or more non-repeating ':'s.
-----

So it looks to me like that function name is illegal, and it's an 
implementation detail that it currently is allowed to work. 

Usually parsing fixes for lein repl belong in sjacket 
(https://github.com/cgrand/sjacket/issues), but I'm not 100% convinced the 
parser should say top% is a legitimate symbol. But I'm also not convinced 
it should ever be possible for 2 symbols to be right next to each other 
with no intervening whitespace. Not sure what the right thing to do is 
here. Let's discuss further in an issue on sjacket.

Short-term workaround: `(do top%)`.


On Tuesday, June 17, 2014 9:54:25 AM UTC-5, daveray wrote:
>
> I believe this is a problem with the Leiningen REPL. It works fine from 
> the built-in REPL:
>
> $ java -jar ~/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar
> Clojure 1.5.1
> user=> (def top% 4)
> #'user/top%
> user=> top%
> 4
>
> Dave
>
>
>
>
> On Tue, Jun 17, 2014 at 1:32 AM, Mike Thompson <m.l.tho...@gmail.com 
> <javascript:>> wrote:
>
>> At the REPL ... 
>>
>>
>> user=> (def top% 4)       ;; an unusually named var
>> #'user/top%
>>
>> But later, it I try to use this var, trouble ...
>>
>> user=> top%
>>
>> CompilerException java.lang.RuntimeException: Unable to resolve symbol: 
>> top in this context, 
>> compiling:(Local\Temp\form-init6773082655831127234.clj:1:734)
>> CompilerException java.lang.RuntimeException: Unable to resolve symbol: % 
>> in this context, 
>> compiling:(Local\Temp\form-init6773082655831127234.clj:1:734)
>>
>>
>> Not sure what to make if this. Obviously % is a bit special.  And it is 
>> certainly not a significant problem for me, at all.  Just seemed odd that 
>> I'm allowed to successfully do the def, if it is just going to cause 
>> problems later.
>>
>> --
>>
>> Mike
>>
>>
>>
>>
>>
>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> <javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> 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 unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to