Re: Fully lazy sequences are here!

2009-02-19 Thread Arthur Ulfeldt
I would like to second this :) it just looks good! On Wed, Feb 18, 2009 at 8:49 PM, mifrai fraim...@gmail.com wrote: Thanks Rich! Do you think it's worthwhile to add `not-empty?' in the core? It just feels more natural to go: (when (not-empty? (filter even? [1 2])) ...) over (when

Re: Fully lazy sequences are here!

2009-02-18 Thread Frantisek Sodomka
There is something that confuses me: user= (cycle []) () user= (= (cycle []) ()) true user= (= (cycle []) nil) true user= (= () nil) false Thanks for answering, Frantisek On Feb 18, 3:54 am, Rich Hickey richhic...@gmail.com wrote: On Feb 17, 4:16 pm, Frantisek Sodomka fsodo...@gmail.com

Re: Fully lazy sequences are here!

2009-02-18 Thread Frantisek Sodomka
I believe it's already done. Frantisek On Feb 18, 12:39 pm, Mark Volkmann r.mark.volkm...@gmail.com wrote: Now that next is recommended over rest, should nthrest be renamed to nthnext? -- R. Mark Volkmann Object Computing, Inc. --~--~-~--~~~---~--~~ You

Re: Fully lazy sequences are here!

2009-02-18 Thread Frantisek Sodomka
What about 'conj'? Documentation says: (conj nil item) returns (item). Currently: user= (conj nil 1) (1) user= (conj () 1) (1) Idiom conj nil is used in 'reverse': (reduce conj nil coll) Currently: user= (reverse [1 2]) (2 1) user= (reverse [1]) (1) user= (reverse []) nil It looks that now all

Re: Fully lazy sequences are here!

2009-02-18 Thread Frantisek Sodomka
Or maybe more general question: Is there any function in Clojure which when returning empty sequence, returns nil instead of () ??? user= (butlast [1 2 3]) (1 2) user= (butlast [1]) nil user= (butlast []) nil Thanks, Frantisek On Feb 18, 5:46 pm, Frantisek Sodomka fsodo...@gmail.com wrote:

Re: Fully lazy sequences are here!

2009-02-18 Thread Chouser
On Wed, Feb 18, 2009 at 11:46 AM, Frantisek Sodomka fsodo...@gmail.com wrote: What about 'conj'? Documentation says: (conj nil item) returns (item). Currently: user= (conj nil 1) (1) user= (conj () 1) (1) Is there something wrong with that? It looks right and like it matches the docs

Re: Fully lazy sequences are here!

2009-02-18 Thread Frantisek Sodomka
How should I say it... It just didn't look symmetrical to me. So, basically, there is a difference between functions returning sequences - depending on if they are lazy or eager. Hmm... user= (reverse []) nil user= (if (reverse []) true false) false user= (if (seq (reverse [])) true false)

Re: Fully lazy sequences are here!

2009-02-18 Thread Stefan Rusek
On Wed, Feb 18, 2009 at 8:02 PM, Rich Hickey richhic...@gmail.com wrote: On Feb 18, 12:20 pm, Frantisek Sodomka fsodo...@gmail.com wrote: How should I say it... It just didn't look symmetrical to me. So, basically, there is a difference between functions returning sequences - depending on

Re: Fully lazy sequences are here!

2009-02-18 Thread Rich Hickey
On Feb 18, 2:09 pm, Stefan Rusek sru...@gmail.com wrote: On Wed, Feb 18, 2009 at 8:02 PM, Rich Hickey richhic...@gmail.com wrote: On Feb 18, 12:20 pm, Frantisek Sodomka fsodo...@gmail.com wrote: How should I say it... It just didn't look symmetrical to me. So, basically, there is a

Re: Fully lazy sequences are here!

2009-02-18 Thread Frantisek Sodomka
At this point test-clojure doesn't generate any new failures or errors (except the old 'mod' function failures). Coverage is still relatively small, but (cycle []) bug and case of (reverse []) were caught with its help when rewriting tests :-) Thanks for all the fixes! Frantisek On Feb 18,

Re: Fully lazy sequences are here!

2009-02-18 Thread mifrai
Thanks Rich! Do you think it's worthwhile to add `not-empty?' in the core? It just feels more natural to go: (when (not-empty? (filter even? [1 2])) ...) over (when (seq (filter ..)) ..) What do you think? - Mike On Feb 17, 11:43 am, Rich Hickey richhic...@gmail.com wrote: I've merged

Fully lazy sequences are here!

2009-02-17 Thread Rich Hickey
I've merged the lazy branch into trunk, SVN rev 1287 Please do not rush to this version unless you are a library/tool developer. Let them do their ports and chime in on their progress. Move only when the libs/tools you depend upon have been ported. Thanks to all for your feedback and input!

Re: Fully lazy sequences are here!

2009-02-17 Thread Chouser
On Tue, Feb 17, 2009 at 2:43 PM, Rich Hickey richhic...@gmail.com wrote: I've merged the lazy branch into trunk, SVN rev 1287 Please do not rush to this version unless you are a library/tool developer. Let them do their ports and chime in on their progress. Move only when the libs/tools you

Re: Fully lazy sequences are here!

2009-02-17 Thread Frantisek Sodomka
That was fast! ;-) Rich, I am porting test_clojure and old 'cycle' worked as: (cycle []) = nil Currently: (cycle []) = java.lang.StackOverflowError Frantisek On Feb 17, 8:43 pm, Rich Hickey richhic...@gmail.com wrote: I've merged the lazy branch into trunk, SVN rev 1287 Please do not rush

Re: Fully lazy sequences are here!

2009-02-17 Thread Rich Hickey
On Feb 17, 4:16 pm, Frantisek Sodomka fsodo...@gmail.com wrote: That was fast! ;-) Rich, I am porting test_clojure and old 'cycle' worked as: (cycle []) = nil Currently: (cycle []) = java.lang.StackOverflowError Fixed in svn 1290 - thanks for the report. Rich

Re: Fully lazy sequences are here!

2009-02-17 Thread Chouser
On Tue, Feb 17, 2009 at 3:47 PM, Chouser chou...@gmail.com wrote: On Tue, Feb 17, 2009 at 2:43 PM, Rich Hickey richhic...@gmail.com wrote: Please do not rush to this version unless you are a library/tool developer. Let them do their ports and chime in on their progress. Move only when the