Re: time lies, even with doall

2009-01-30 Thread Michael Wood
On Mon, Jan 26, 2009 at 6:24 AM, e wrote: > ok, I'll check that stuff out. Thanks. > > It occurs to me this is being compared to something in ruby called > partition. I like that name. "partition-by" ... but maybe it was opted to > use the simpler name, which I can appreciate. There is alread

Re: time lies, even with doall

2009-01-25 Thread e
ok, I'll check that stuff out. Thanks. It occurs to me this is being compared to something in ruby called partition. I like that name. "partition-by" ... but maybe it was opted to use the simpler name, which I can appreciate. On that subject, I know "filter" is standard from other languages li

Re: time lies, even with doall

2009-01-25 Thread Stephen C. Gilardi
On Jan 25, 2009, at 5:24 PM, e wrote: Do folks in the contrib group like this new implementation? To make contributions to clojure-contrib, you'll need to have a Contributor Agreement on file with Rich. Please see http://clojure.org/contributing . I think your implementation is an impro

Re: time lies, even with doall

2009-01-25 Thread e
ok, those times make sense. The times are at least half the speed from the single pass, and more so because no recursion. So you have to do "dorun" to force the evaluation of each list? I was wondering about this, too. If you had done doall on the answer, it wouldn't have been a "deep execution"

Re: time lies, even with doall

2009-01-25 Thread Stuart Sierra
Hi e, Most of the time is taken up by printing, which is why you see the same times. Here's an example that gives the results you would expect. user> (def numbers (doall (take 50 (repeatedly #(rand-int 3000) #'user/numbers user> (defn predicate [x] (< x 1500)) #'user/predicate user> (dot

Re: time lies, even with doall

2009-01-25 Thread e
oh, so anyway, i put it in that specific place because I wasn't sure if, without it, l1 would just be some sort of smart, lazy list that only exists when you start trying to get the values. I didn't think so, but, again, I'm just trying to shotgun the problem. On Sun, Jan 25, 2009 at 1:57 PM, e

Re: time lies, even with doall

2009-01-25 Thread e
people are paying a lot of attention to "pure" functional languages, which I think mean ones that don't ever destroy data structures out from under people pointing at them. Instead, people who need different views just get their own different views -- possibly reusing common components. This othe

Re: time lies, even with doall

2009-01-25 Thread Emeka
Hi e, I'm still learning the basics, very much like you( I guess you are ahead of me in Clojure). However, I have a question for you and not an answer to your questions. Why do you have doall here (def l1 (doall (take 5 (repeatedly #(rand-int 3000) . From my little knowledge of Clojure, ta

time lies, even with doall

2009-01-25 Thread e
The IRC channel folks helped me implement what we discovered was already called "separate" in contribs. My point was to do a partition that generated the two lists "(passes pred)" and "(fails pred)" in one pass without recursion. We ended up with: (defn filt-rem [pred coll] (loop [l1 () l2