Laziness in filter

2013-03-17 Thread bruce li
Hello, everyone. I'm writing some code that utilizes the lazy sequence. But I found something strange. Here is how: The code is like: (first (filter some-expensive-io urls)) The code is aimed to find the first result of the operations on the urls that is not nil. However, it seems that the io

Re: Laziness in filter

2013-03-17 Thread Evan Mezeske
I'd guess that what you're seeing is related to chunked sequences: http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ . On Sunday, March 17, 2013 1:12:17 AM UTC-7, bruce li wrote: Hello, everyone. I'm writing some code that utilizes the lazy sequence. But I found something

Re: Laziness in filter

2013-03-17 Thread dennis zhuang
Yep,it's chunked sequence,just like batch processing. You can use the seq1 function in fogus blog. 2013/3/17 Evan Mezeske emeze...@gmail.com I'd guess that what you're seeing is related to chunked sequences: http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ . On Sunday,

Re: Laziness in filter

2013-03-17 Thread Marko Topolnik
This is one of the most frequenly-asked questions and a source of surprise to practically every new Clojure user. An update to the official documentation on lazy sequences would surely help a lot here. -marko On Sunday, March 17, 2013 9:18:05 AM UTC+1, Evan Mezeske wrote: I'd guess that what

Re: Laziness in filter

2013-03-17 Thread bruce li
Ah, it works. It is really chunked sequences. Thanks. Having been using clojure for half a year, it keeps really bringing me surprise and fun :) 2013/3/17 Marko Topolnik marko.topol...@gmail.com This is one of the most frequenly-asked questions and a source of surprise to practically every