It is used as an "anonymous variable", when you don't care of a value:

user=> (let [myfn (fn [a b] (#(+ a b)))] (reduce myfn '(1 2 3 4 5)))
15
user=> (let [myfn (fn [a _] (#(+ a a)))] (reduce myfn '(1 2 3 4 5)))
16

On Thu, Nov 20, 2008 at 11:32 AM, Timothy Pratley
<[EMAIL PROTECTED]>wrote:
>
>>
>> > I didn't find any description of the symbol _ in the Clojure docs.
>> > What is its exact status? Is it an ordinary symbol that is used by
>> > convention for unused arguments? Or is it interpreted in a special
>> > way by the reader or the compiler?
>>
>> Looks like it is just an ordinary symbol used by convention:
>>
>> user=> (def _ "fun")
>> #=(var user/_)
>> user=> _
>> "fun"
>>
>> user=> (defn x [_] _)
>> #=(var user/x)
>> user=> (x 1)
>> 1
>>
>> Ironic really, considering it is such a controversial character :)
>>
>
>

--~--~---------~--~----~------------~-------~--~----~
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
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