On Dec 26, 2009, at 2:37 , Nicolas Buduroi wrote:
>
> I'll have a look at this, it would certainly make this function more
> idiomatic to Clojurians.
>
> Thanks for the suggestion.
I've another one I like even better, it get's a bit away from mapping over n
list but it could achiev the same:
(defn extend-tupel [default & lists]
(if (some (complement empty?) lists)
(cons
(map (fn [l] (if (empty? l) default (first l))) lists)
(lazy-seq (apply extend-tupel default (map next lists))))
nil))
This takes a default value and N lists, then creates s tupels form this lists
untill all are empty, filling the ones that are empty before the rest with the
default value. You could use destruction in your map to make it look like
mapping over multiple lists. I like this better since each list will only
walked once, this is especially nicer in my eyes when it are lazy lists that
need to be evaluated each time the list is accessed.
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 [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en