Hi,

On 20 Aug., 10:25, probertm <probe...@gmail.com> wrote:

> New here to Clojure-land and loving what I am seeing, though I am not
> getting some of the forms yet.
>
> Can someone help me with contrib.str-utils2/dochars?  I have a need to
> iterate over each character in a string and this seems to be a macro
> that will do that (I suppose I could create my own map function but
> that kind of misses the point ;) ).
>
> The doco says
>
>   Usage: (dochars bindings & body)
>   bindings => [name string]
>   Repeatedly executes body, with name bound to each character in
> string.
>
> which I don't really understand.  Any examples gratefully accepted.

(dochars [ch "Hello, World!"]
  (println ch))

I suppose it is faster than doseq, which should probably work similar
to dochars for strings.

dochars is purely for side-effects since it will always return nil. So
if you want to do something functionally with every character you
probably want to map a function over the string or use for.

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

Reply via email to