On 25 Feb., 15:02, Stuart Sierra wrote:
> I often find I need to do this when the mapping function depends on a
> dynamic context, like an open stream or an SQL connection. I'm not
> using side effects in this case, but I have to make sure that the
> sequence is completely realized before leaving
The dynamic resource consumption discussion is interesting & I'm
curious about scope, but just to be clear about side-effects in the
case of:
(dorun (map #(println %) my-vector))
The idiomatic way to do this is
(doseq [i my-vector] (println i))
Perry
--~--~-~--~~~--
On Feb 25, 9:12 am, Jeffrey Straszheim
wrote:
> I really like the "close it as the last item in the sequence" trick. Sadly,
> I don't see how it can be made exception safe.
>
Or partial consumption safe.
But there is a solution I've already developed for resource management
scope, called sco
I really like the "close it as the last item in the sequence" trick. Sadly,
I don't see how it can be made exception safe.
On Wed, Feb 25, 2009 at 9:02 AM, Stuart Sierra
wrote:
>
> On Feb 25, 8:29 am, Meikel Brandmeyer wrote:
> > That's interesting. I almost never use doall or dorun together wi
On Feb 25, 8:29 am, Meikel Brandmeyer wrote:
> That's interesting. I almost never use doall or dorun together with
> map. I found that most side-effects don't give interesting result
> values.
I often find I need to do this when the mapping function depends on a
dynamic context, like an open s
On Wed, Feb 25, 2009 at 7:29 AM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 24.02.2009 um 22:25 schrieb Mark Volkmann:
>
>> Right. That's what I'm doing now ... in many places. I was just asking
>> if there is a single function that combines them. It seems reasonable
>> to have one since those to func
Hi,
Am 24.02.2009 um 22:25 schrieb Mark Volkmann:
Right. That's what I'm doing now ... in many places. I was just asking
if there is a single function that combines them. It seems reasonable
to have one since those to functions seem to be called together a lot.
That's interesting. I almost ne
On Tue, Feb 24, 2009 at 2:08 PM, Jason Wolfe wrote:
>
> On Feb 24, 2009, at 12:07 PM, Jason Wolfe wrote:
>
>>
>> On Feb 24, 2009, at 11:58 AM, Mark Volkmann wrote:
>>
>>> On Tue, Feb 24, 2009 at 12:23 PM, Jason Wolfe
>>> wrote:
You could use doseq?
>>>
>>> I don't have a body to execut
On Feb 24, 2009, at 12:07 PM, Jason Wolfe wrote:
>
>
> On Feb 24, 2009, at 11:58 AM, Mark Volkmann wrote:
>
>>
>> On Tue, Feb 24, 2009 at 12:23 PM, Jason Wolfe
>> wrote:
>>>
>>> You could use doseq?
>>
>> I don't have a body to execute though. I need to build things with
>> map first.
>>>
>
>
>
On Feb 24, 2009, at 11:58 AM, Mark Volkmann wrote:
>
> On Tue, Feb 24, 2009 at 12:23 PM, Jason Wolfe
> wrote:
>>
>> You could use doseq?
>
> I don't have a body to execute though. I need to build things with
> map first.
>>
Huh? As far as I know, as long as you're only iterating through
On Tue, Feb 24, 2009 at 1:00 PM, Stuart Sierra
wrote:
>
> I've occasionally thought of adding "domap" to clojure.contrib.seq-
> utils:
>
> (defn domap [f coll]
> (doall (map f coll)))
I'd use that.
> -Stuart Sierra
>
> On Feb 24, 1:23 pm, Jason Wolfe wrote:
>> You could use doseq?
>>
>> Now,
On Tue, Feb 24, 2009 at 12:23 PM, Jason Wolfe wrote:
>
> You could use doseq?
I don't have a body to execute though. I need to build things with map first.
> Now, if you want eager evalation *and* a result seq, I think you're
> stuck with (doall (for ...)) or (doall (map ...)).
Yeah.
> On Feb
I've occasionally thought of adding "domap" to clojure.contrib.seq-
utils:
(defn domap [f coll]
(doall (map f coll)))
-Stuart Sierra
On Feb 24, 1:23 pm, Jason Wolfe wrote:
> You could use doseq?
>
> Now, if you want eager evalation *and* a result seq, I think you're
> stuck with (doall (for .
You could use doseq?
Now, if you want eager evalation *and* a result seq, I think you're
stuck with (doall (for ...)) or (doall (map ...)).
-Jason
On Feb 24, 9:49 am, Mark Volkmann wrote:
> It seems that, at least in demo code that I write, I frequently call
> dorun on the lazy sequence return
It seems that, at least in demo code that I write, I frequently call
dorun on the lazy sequence returned by map to force side effects such
as calls to println. I know I could write my own function that
combines those, but does such a thing already exist? I don't want to
reinvent the wheel or use a
15 matches
Mail list logo