Sean writes:
> And now everything works great. What I don't understand is why the
> doseq macro is required instead of the mapping operation. Could
> somebody explain why Clojure has this different form for functions
> that have side effects?
My take on this is that map supports a functional
On Apr 3, 3:29 am, Eric Tschetter wrote:
> That is, "map" is more geared towards type "conversion" of the
> elements in a collection, but it is only converting the elements in
> the collection, not the collection itself.
>
> (some ellided text here...)
>
> Reduce (also known as fold left) consume
Laziness is the rule only on sequence operations.
On Apr 2, 11:34 pm, Sean wrote:
> Thanks for the response everyone! I was able to get it working. If I
> understand what everyone is saying, the following statement is true:
>
> In Clojure, laziness is the rule not the exception.
--~--~---
> Thanks for the response everyone! I was able to get it working. If I
> understand what everyone is saying, the following statement is true:
>
> In Clojure, laziness is the rule not the exception.
Rather than that, I'd say that you are thinking about map wrong (hope
that doesn't come across as
Thanks for the response everyone! I was able to get it working. If I
understand what everyone is saying, the following statement is true:
In Clojure, laziness is the rule not the exception.
On Apr 2, 10:29 pm, Matt Revelle wrote:
> Were you in #clojure earlier? This came up there and pjsta
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 fun
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.
--~--~-~--~~
>From map's docstring: "Returns a lazy sequence [...]"
So I guess you applied map at the top level and wondered why side-
effects didn't happen.
Try:
(dorun (map #(form-with-side-effects %) a-list))
Or, for fun:
(take 1 (map #(form-with-side-effects %))
Basically, since your map wasn't n
Hi everyone,
I'm working with awt to do create an image renderer. This is
obviously an application where side effects are desired. My first
attempt was this:
(map #(form-with-side-effects %) a-list)
This didn't do what I expected. After a little while, I found the
doseq macro. I re-wrote my