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 <[email protected]> > 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 [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
