On Sat, Nov 17, 2012 at 5:32 PM, Milen Ivanov <milen.iva...@gmail.com> wrote: > Dear Mr. Chose, > > Thank you for your help! > > So, the "bug" is then in the book. Fine.
There's no "bug" in the book. You copied sample code that's meant to show the syntax of using conj directly into the repo, using undeclared values. (conj coll item) is not meant to run on its own. It's demonstrating that the function conj takes a collection and an item, and returns a new collection with the item added on. So as BG pointed out, you can do: (conj [1 2 3] 4), in which [1 2 3] is a collection (vector) and 4 is the item to be conj'd, which returns a new vector [1 2 3 4]. (conj '(1 2 3) 4), in which '(1 2 3) is a collection (list) and 4 is the item to be conj'd, which returns a new list (4 1 2 3) If you want to do (conj coll item) you need to define coll and item, which BG did as: (def coll [1 2 3 4 5]) (def item 6) Now that "coll" and "item" exist, you can do (conj coll item), which is the same as doing (conj [1 2 3 4 5] 6). But you cannot simply do (conj coll item), and this is not a "bug" in the book, but rather a description of how conj works. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- 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