Re: Joy of Clojure errata: Chapter 5
On Tue, May 17, 2011 at 10:53 PM, Aaron Bedra aaron.be...@gmail.com wrote: On 05/17/2011 09:21 PM, Ken Wesson wrote: On Tue, May 17, 2011 at 5:57 PM, pmbauerpaul.michael.ba...@gmail.com wrote: Manning's forum would be a better home for errata than the Clojure mailing list. http://www.manning-sandbox.com/forum.jspa?forumID=624 Sorry; I don't really care for web forums much. I think mailing lists and Usenet are much to be preferred. Please do use Manning's forum for this. Actually, I can't. My copy is borrowed, for now, rather than my own, so I don't have an account there. It will help the authors and the publisher track the errata in the proper way and reduce the traffic on this list. One of the authors has already noticed this thread, so the question of making sure the authors notice it is moot. As for traffic on this list, is it not sufficient to limit the discussion to this one thread? Anyway, I found two oddities near the end of Chapter 8. In Listing 8.9: (let [stream (joc-www)] (with-resource [page stream] #(.close %) (.readLine page))) The third line could just read .close, as here is where it is used: (~close-fn ~(binding 0)) This would become (.close stream) in this instance, which is a valid Java invocation form. Unlike with a HOF, there's no need in this context to wrap .close in a closure. And in Listing 8.11 there are two lines that resemble this: (assoc {} :pre (vec (rest con))) This could just be {:pre (vec (rest con))}. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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
Re: Joy of Clojure errata: Chapter 5
Sorry; I don't really care for web forums much. I think mailing lists and Usenet are much to be preferred. Please do use Manning's forum for this. Actually, I can't. My copy is borrowed, for now, rather than my own, so I don't have an account there. Actually, you can. You just have to take a few minutes to create an account so errata can go to the appropriate place. http://www.manning-sandbox.com/accountCreate!default.jspa -- 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
Re: Joy of Clojure errata: Chapter 5
On Mon, May 16, 2011 at 9:44 AM, Fogus mefo...@gmail.com wrote: Hi Ken, Thanks for this. I agree that a different name would be much more clear. Here's one from chapter 7. Section 7.1.2, near the end, has: Perhaps you see a familiar pattern: we apply the column-names vector as a function across a set of indices, building a sequence of its elements at those indices. This action will return a sequence of the values of that row for the supplied column names, which is then turned into a vector so that it can then be used as the sorting function This does not seem to be correct. It seems to be applying the row map as a function across a seq of column names, building a sequence of its elements at those column keys. This action will return a sequence of the values of that row for the supplied column names, which is then turned into a vector so that it can then be used as the sort key. The function that *returns* the vector is the sorting function. (Interesting that sort will sort vectors, by lexicographic ordering. It doesn't seem to like lists, though, which is odd since the same rule would naturally apply. (Sure it could hang on infinite seqs, but so do lots of other functions, such as print and doall. And it could be implemented, probably fairly easily, to consume only as much of a seq as was needed to determine the sort position; then it would only hang if it hit two infinite seqs that were equal, e.g. two copies of (iterate inc 1).)) -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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
Re: Joy of Clojure errata: Chapter 5
On May 17, 4:35 am, Ken Wesson kwess...@gmail.com wrote: On Mon, May 16, 2011 at 9:44 AM, Fogus mefo...@gmail.com wrote: Hi Ken, Thanks for this. I agree that a different name would be much more clear. Here's one from chapter 7. Section 7.1.2, near the end, has: Perhaps you see a familiar pattern: we apply the column-names vector as a function across a set of indices, building a sequence of its elements at those indices. This action will return a sequence of the values of that row for the supplied column names, which is then turned into a vector so that it can then be used as the sorting function This does not seem to be correct. It seems to be applying the row map as a function across a seq of column names, building a sequence of its elements at those column keys. This action will return a sequence of the values of that row for the supplied column names, which is then turned into a vector so that it can then be used as the sort key. The function that *returns* the vector is the sorting function. (Interesting that sort will sort vectors, by lexicographic ordering. It doesn't seem to like lists, though, which is odd since the same rule would naturally apply. (Sure it could hang on infinite seqs, but so do lots of other functions, such as print and doall. And it could be implemented, probably fairly easily, to consume only as much of a seq as was needed to determine the sort position; then it would only hang if it hit two infinite seqs that were equal, e.g. two copies of (iterate inc 1).)) Vectors implement Comparable, and lists don't. I don't see any clear reason for this, but patching sort is the wrong answer: instead implement Comparable for lists. -- 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
Re: Joy of Clojure errata: Chapter 5
Manning's forum would be a better home for errata than the Clojure mailing list. http://www.manning-sandbox.com/forum.jspa?forumID=624 -- 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
Re: Joy of Clojure errata: Chapter 5
On Tue, May 17, 2011 at 5:57 PM, pmbauer paul.michael.ba...@gmail.com wrote: Manning's forum would be a better home for errata than the Clojure mailing list. http://www.manning-sandbox.com/forum.jspa?forumID=624 Sorry; I don't really care for web forums much. I think mailing lists and Usenet are much to be preferred. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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
Re: Joy of Clojure errata: Chapter 5
On 05/17/2011 09:21 PM, Ken Wesson wrote: On Tue, May 17, 2011 at 5:57 PM, pmbauerpaul.michael.ba...@gmail.com wrote: Manning's forum would be a better home for errata than the Clojure mailing list. http://www.manning-sandbox.com/forum.jspa?forumID=624 Sorry; I don't really care for web forums much. I think mailing lists and Usenet are much to be preferred. Please do use Manning's forum for this. It will help the authors and the publisher track the errata in the proper way and reduce the traffic on this list. -- Cheers, Aaron Bedra -- Clojure/core http://clojure.com -- 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
Re: Joy of Clojure errata: Chapter 5
Hi Ken, Thanks for this. I agree that a different name would be much more clear. As a side note, maybe we could use a single thread for JoC related flubs so as not to clog the mailing list on a chapter-by-chapter basis? Another option is to use Manning's forum at http://www.manning-sandbox.com/forum.jspa?forumID=624. -- 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