Hey, the exercise was to rewrite it with higher order functions, not to make
it clearer !

2009/12/16 Meikel Brandmeyer <m...@kotka.de>

> Hi,
>
> On Dec 15, 10:28 pm, DTH <dth...@gmail.com> wrote:
>
> > Damn, well played sir; that's much cleaner.
>
> Someone, please enlighten me!
>
> Why is this clearer?
>
> (defn foo
>  [a]
>  (let [b f1
>        c (comp f2 b)
>        d (comp f3 c)
>        e (comp f4 d)
>        g (comp f5 c)
>        h (comp f5 f2 e)]
>    (->> (iterate #(f7 (d %) (b %)) a)
>      (filter #(or (f6? (b %)) (<= (g %) (h %))))
>      first
>      e)))
>
> It is more verbose than the loop. It generates 7 additional classes.
> Per iteration step it calls b 5 times and c 3 times. Depending on b
> and c maybe memoize should be considered, too. Why the first of the
> resulting sequence, not the second? (<- The point here is: In which
> way is defining a seq of uninteresting values to obtain a single one
> cleaner than a loop which just returns that desired value? Maybe this
> is really a fixpoint iteration?)
>
> Sincerely
> Meikel
>
> --
> 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