Were you in #clojure earlier?  This came up there and pjstadig and I
raced to implement "domap" and then slashus2 pointed out there was no
need for it to be a macro.

http://gist.github.com/89249

(defn domap
  "A map for side-effects.  The argument order is the same as map, but
unlike map the function results are not retained.  Takes a function
followed by any number of collections and applies the function to the
first item in each coll, then the second etc.  Returns nil."
  [fn & colls]
  (let [num-colls (count colls)]
    (doseq [args (partition num-colls (apply interleave colls))]
      (apply fn args))))

On Apr 2, 10:20 pm, Daniel Jomphe <danieljom...@gmail.com> wrote:
> Daniel Jomphe wrote:
> > Basically, since your map wasn't needed, it wasn't "realized"/
> > executed. Laziness.
>
> Better said:
>
> Basically, since your map's results weren't used, it wasn't
> "realized"/
> evaluated. That's why you didn't see your expected side effects.
> Laziness.
--~--~---------~--~----~------------~-------~--~----~
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
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