Hello,

2009/12/15 DTH <dth...@gmail.com>

> On Dec 15, 9:05 pm, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> >
> > The final step is to apply return-fn to the result:
> > (return-fn
> >   (first (remove
> >                     (comp not predicate-fn)
> >                     (iterate recur-fn a0)))
> >
>
> Damn, well played sir; that's much cleaner.  If I might offer one
> small tweak:
>
> (return-fn (some predicate-fn (iterate recur-fn a0)))
>
> would seem equivalent, though I doubt I'd have got there without your
> stepwise guide to change the way I was thinking about it.
>


No, some does not work here. Dean gave the final word, I think, by reminding
us of filter.

some does not work because it will return the result of applying
predicate-fn to the item, but we want the item "intact" in order to apply
return-fn to it.

But as said  Meikel, and as I was implicitly implying in my final words by
just saying "is it something like that you expected", the loop version is
not so bad with performance considerations in mind.

Cheers,

-- 
Laurent


>
> Cheers,
>
> -DTH
>
> --
> 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<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

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