yes, symbols like keywords lookup themselves into the second element, or
return the third if they cannot find their value
('a {'a 1} 2) ;=> 1
('b {'a 1} 2} ;=> 2

2012/6/7 Alex Shabanov <avshaba...@gmail.com>

> Oh, I see. This is because of the reader that interprets symbols from the
> quoted forms in different way it does for the unquoted ones (and this
> feature still strikes me as odd).
> To make matters more complicated the quoted symbols seems to have some
> meanings as functions for the clojure, since ('foo 1) -> nil, ('foo 1 2) ->
> 2, ('foo 1 2 3 4) -> arity exception.
>
> четверг, 7 июня 2012 г., 20:05:43 UTC+4 пользователь Bronsa написал:
>
>> you' are calling (apply 'foo '(1 2)), what you want is (apply foo '(1 2))
>> just call bar as
>> (bar (list foo 1 2))
>>
>> 2012/6/7 Alex Shabanov <avshaba...@gmail.com>
>>
>>> I'm curious why the following form evaluates to 2:
>>>
>>> (defn foo [& more]
>>>   (println "foo(" more " )"))
>>>
>>> (defn bar [v]
>>>   (apply (first v) (rest v)))
>>>
>>> (bar '(foo 1 2))
>>>
>>> If the form (bar '(foo 1 2)) extended to, say, (bar '(foo 1 2 3 4)) the
>>> arity exception will be thrown.
>>> The behavior can be reproduced after picking another names for foo
>>> and/or bar functions.
>>>
>>> --
>>> 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+unsubscribe@**googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
>>> For more options, visit this group at
>>> http://groups.google.com/**group/clojure?hl=en<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 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 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

Reply via email to