Hi,

Am 03.11.2011 um 12:18 schrieb Ben Smith-Mannschott:

> There is no such thing as an empty seq. Or put another way, the empty
> seq *is* nil. You're probably thinking of an empty list.

while this is true, the following is dangerous

> Returning nil has the advantage that nil is false in a boolean context.
> 
> (when-let [s (apply interleave ...)] ... )

The input sequences to interleave might be all nil. Since interleave is also 
lazy, you have to put a seq around the apply when you use it in a when-let.

Whether (interleave) returns nil or () is not really important, since you have 
to call seq on it anyway. I'd probably prefer nil. My general approach is to be 
as lazy as possible, but only if necessary. (interleave) can judge immediately 
that it will never ever need laziness, because there are no inputs. So it can 
return nil immediately. Maybe a matter of taste.

Sincerely
Meikel
 

-- 
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

Reply via email to