Hi Mark, What the documentation means is that you give dochars a "name" for a variable and a string to process. It then iterates over each character in the string using 'name' as a variable representing the character, so that each of the (0 or more) forms in the body can "do" something with the character by referring to "name": (dochars [ch "Is this not pung?"] (print (Character/toUpperCase ch)))
However, what you probably want to do is use 'map' to transform one string to another: (map (fn [ch] (Character/toUpperCase ch)) "Is this not pung?") => (\I \S \space \T \H \I \S \space \N \O \T \space \P \U \N \G \?) But now we've wound up with a sequence rather than a string specifically, so we need one more step: (apply str (map (fn [ch] (Character/toUpperCase ch)) "Is this not pung?")) => "IS THIS NOT PUNG?" Have all good days, David Sletten On Aug 20, 2010, at 4:25 AM, probertm wrote: > Hi... > > 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. > > TIA .. mark. > > -- > 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