On Sun, 16 Dec 2012, mond wrote:

One small thing Ben... when I try to use the final formulation I receive an 
error:
(def joined-products (map product-with-item products))

user=> (joined-products)
ClassCastException clojure.lang.LazySeq cannot be cast to clojure.lang.IFn  
user/eval241 (NO_SOURCE_FILE:9)

Any ideas?

To evaluate a list, Clojure tries to call the first element as a function, with the remaining elements as its arguments. So, in this case:

  (joined-products)

Clojure tries to cast the first element of the list (joined-products) to be used as a Clojure function (clojure.lang.IFn), but it's a lazy sequence (clojure.lang.LazySeq).

You just don't need the list:

user=> joined-products
(#user.Product{...} #user.Product{...} #user.Product{...} ...)

--
Best,
Ben

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