On Sat, Nov 17, 2012 at 3:11 PM, Charlie Griefer <charlie.grie...@gmail.com>wrote:
> For the record, I point out that its not a "bug" specifically because > you will see this many many many many times throughout the book. In > fact, pretty much any time a new function or form is introduced. > > (function-name argument-1 argument-2 ... argument-n) > > This is not real code meant to be pasted into the REPL and evaluated, > but rather a high level example of how a particular function works. > > Hope that helps :) > > I wouldn't lay money on a bet that it does. R > On Sat, Nov 17, 2012 at 5:46 PM, Charlie Griefer > <charlie.grie...@gmail.com> wrote: > > 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. > > > > -- > 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 > -- Russell Whitaker http://twitter.com/OrthoNormalRuss / http://orthonormalruss.blogspot.com/ http://www.linkedin.com/pub/russell-whitaker/0/b86/329 -- 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