On May 30, 6:15 pm, iz bash <[email protected]> wrote:
> how'd you implement it using only higher order functions?
> (rem-dup "aaaa bb cc") => [\a \a \a \a \space \b \b
> \space \c \c]
(defn rem-dup [stri]
(->> stri
(partition-all 2 1)
(filter (partial apply not= \space))
(map first)
vec))
For a lazy version, remove vec to leave it as a lazy list.
Vectors are fully-realized, so no laziness.
> also itd be great if you guys could give some pointers on using higher
> order functions and lazy sequences in place of a loop recur.
I'm fond of the ->> macro - it encourages thinking in terms of
transformation of a data flow. When it is suitable, the result is
also often pleasingly terse.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en