For this particular case, you could also use regexps:

user> (require '[clojure.string :as s])
nil
user> (s/replace "aaaa              bb cc" #" +" " ")
"aaaa bb cc"

Regards,
Stuart

On 31 May 2011 08:15, iz bash <killernemesisbl...@gmail.com> wrote:

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

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