so clojures like my first programming language. most of the time
now ,i use map /reduce/.. with lazy sequences but sometimes i just
cant seem to find a solution other than using loop-recur. then i read
somewhere almost all loop recur situations can be translated into
reduce. so ive posted a function below...how'd you implement it using
only higher order functions?
(defn rem-dup [stri]
(loop [[x y & z] (seq stri) ,bui []]
(cond (nil? x) bui
(= x y \space) (recur (cons y z) bui)
:else (recur (cons y z) (conj bui x)))))
(rem-dup "aaaa bb cc") => [\a \a \a \a \space \b
\b \space \c \c]
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.
Thanks!!
and btw clojures totally awesome :)
--
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