It seems to be a design decision that 0-arity invoke of a composite data 
type gives an ArityException: the composite data type does not implement 
the IFn when no arguments are given.
Is there a certain design decision behind this behavior? (or a certain 

repl> ;composite data type evaluates to itself
repl> {:a 1 :b (hash "word")} 
{:a 1 :b -304538205}
repl> '{:a 1 :b (hash "word")}
{:a 1 :b (hash "word")}
repl> (def mydata '{:a 1 :b (hash "word")})
repl> mydata
{:a 1 :b (hash "word")}
repl> ;composite data type implements IFn for its keys
repl> (mydata :b)
(hash "word")
repl> ; there is no '0-arity' implementation of IFn for composite data type
repl> ({})
... (ArityException)...
repl> (mydata)
... (ArityException)...
repl> ; instead i have to type eval
repl> ((eval mymap) :b)

I know its only 4 letters and a space extra, but software composition is 
supposed to avoid code duplication and perhaps the idea makes sense that 
invoking a map without arguments evaluates it... Hence the question about 
the choice made for the current behavior.

A possible small workaround  
(defrecord qid [qid]                                                
     (invoke [this] (eval qid))
But expect this to throw alot of bugs: this record is not the same simple 
(issues with other protocols, reducers, transducers and much more I don't 
know of.)

I hope this is the right google group to ask this question.
kind regards,

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
For more options, visit this group at
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.
To view this discussion on the web visit 

Reply via email to