On Dec 26, 2009, at 21:09 , Meikel Brandmeyer wrote:
> Here is a more idiomatic (and fully lazy) version using the fnil function 
> proposed by Rich here: 
> http://groups.google.com/group/clojure/msg/f251cfd9baab440a
> 
> (defn extend-tupel
>  [default & lists]
>  (lazy-seq
>    (let [seqs (map seq lists)]
>      (when (some identity seqs)
>        (cons (map (fnil first default) seqs)
>              (apply extend-tupel default (map rest seqs)))))))
> 
> Sincerely
> Meikel
> 
I didn't checked for nil but for empty? on purpose, nil might also be a value 
in a list - I know it's will not be common but a list that has '(nil 1 2 3) 
would become '(<default> 1 2 3) if checking for nil and not empty. So your 
approach to wrap the lazy seq around it all is a good idea and makes the whole 
thing much nicer :).


Best Regards,
Heinz

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