alist is missing parens around the fn, so it's really a list of 4 elements 
like so:

  (1, fn, [x y], (+ x y))

So (second alist) returns just the symbol 'fn.  And when you apply a Symbol 
to a list, the result is the last item in the list (not sure why).

To do what you want, alist should be defined like this:

  (def alist '(1 (fn [x y] (+ x y))))

Also, it seems that the definition of the function needs to be eval'ed first 
to become an apply-able function.  The following returns 4 in my REPL:

  (apply (eval (second alist)) '(1 3))

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