Re: Learning Clojure

2008-12-10 Thread Brian Will
A Java reference type is basically any type allocated on the heap. The four Clojure reference types are particular Java reference types. My complaint is this is exactly the sort of weirdness that causes learners to scratch their heads. Not the biggest issue, sure, but this sort of thing is nice to

Re: Learning Clojure

2008-12-10 Thread Brian Will
towards the end. Vars have to be introduced before I can discuss namespaces, but the thread- local binding aspect of Vars can be deferred to later. btw, you'll see a few notes I left in the text in square brackets where I wasn't sure on some point.

Re: Learning Clojure

2008-12-10 Thread Brian Will
Hopefully keeping the whole text reasonably short will encourage volunteers. Thanks for your feedback. --Brian Will --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group

Re: Learning Clojure

2008-12-11 Thread Brian Will
Tim, just go ahead and make any changes you like. If I don't like them, I can always revert ;) Actually, I'm sure anything you add we can find a place for, but like I said, that would likely be a separate example page in most cases. Thanks, Randall, I mention keywords-as-functions where I talk ab

iteration idioms

2008-12-12 Thread Brian Will
st old) (prepend3 new (first old) user=> (24 6 3 5 3 5 7 3 5 3 2) Again, hardly elegant. Maybe there's a cleaner way to use loop in these cases, or maybe I'm just forgetting some function(s) to use. Hopefully someone can demonstrate better idioms to handle

Re: iteration idioms

2008-12-12 Thread Brian Will
Thanks, Mark. I don't suppose (reduce into ...) is a common enough idiom that it deserves its own function? Perhaps (into x) should do (reduce into x), e.g. (into [[3 5] [6 7]]) => [3 5 6 7]. This makes sense to me, but maybe it's too semantically different from (into x y). If not, though, you co

Re: literate snake

2009-01-03 Thread Brian Will
ght (and (= direction :up) top right-half) :left true direction))) --Brian Will On Jan 2, 11:07 am, "Mark Volkmann" wrote: > I've written a new version of the snake program that uses a more > literate style and therefore, to my eyes, calls for far fewer > co

Re: literate snake

2009-01-03 Thread Brian Will
ection :down) at-bottom) (if left-half :right :left) (and (= direction :left) at-left) (if top-half :down :up) (and (= direction :up) at-top) (if left-half :right :left) true direction))) On Jan 3, 9:28 am, "Mark Volkmann" wrote: > On Sat, Jan 3, 2009 at 3:03 AM, Br

Re: meaning and pronunciation of Clojure

2009-01-03 Thread Brian Will
Yes. Pronounced "closure" as if the "j" is French. On Jan 3, 1:06 pm, "Mark Volkmann" wrote: > I assume that the name "Clojure" is taken from the word "closure", > replacing the "s" with a "j" for Java. I've never seen that in writing > though and my curiosity compels me to have this verified. I

Re: automatic concurrency

2009-01-03 Thread Brian Will
licit direction from the programmer, however, is another matter. The implementations of Haskell that do this are experimental and not widely used. http://en.wikipedia.org/wiki/Automatic_parallelization --Brian Will On Jan 3, 12:20 pm, "Mark Volkmann" wrote: > One of the s

Re: automatic concurrency

2009-01-03 Thread Brian Will
rite event-driven code, but it would all involve just one thread, much like Javascript events work in the browser now.) > The article looks out-of-date and inaccurate, alas... Yeah, I got this impression as well. I coulda sworn it was better the last time I looked at it. --Brian Will On

Is syntax quote "reader" only?

2009-02-16 Thread Brian Will
I'm a bit mystified how syntax quote does what it does. I don't see how syntax quote can quote the whole while unquoting parts without some evaluation-time intervention. If I had to implement it myself, I'd just punt the problem to evaluation-time by introducing a special form 'unquote', e.g.:

Looping idiom

2009-09-07 Thread Brian Will
Very basic question. What's the idiom for producing a new seq wherein each val is based on pairs from an existing seq, e.g.: ; add together n0 n1, n1 n2, n2 n3, etc. [1 2 3 4 5 6] ; giving... [3 5 7 9 11] The verbose way would be something like: (loop [s origSeq n [ ]) (let [a (first or

Re: Looping idiom

2009-09-07 Thread Brian Will
should read: (loop [s origSeq n [ ]) (let [a (first s b (second s)] (if (nil? b) n (recur (rest s) (conj n (+ a b)) On Sep 7, 6:51 pm, Brian Will wrote: > Very basic question. What's the idiom for producing a new seq