Here's another solution that came from help on the chat. Thanks Chouser!

(apply str (interpose " " (reverse (.split "I am cold" " "))))

On Tue, Nov 18, 2008 at 7:15 PM, islon <[EMAIL PROTECTED]> wrote:
>
> (defn string-reverse [s]
>  (reduce #(str %1 " " %2) (reverse (seq (. s (split " "))))))
>
> You're probably looking for something like this =)
>
> On Nov 18, 9:00 pm, joejoe <[EMAIL PROTECTED]> wrote:
>> hello all,
>> so I'm not only new to this group but I am new to Clojure.  I may be
>> going about this all wrong but here's what I got.  I want to simply
>> take a string and reverse it, ex: "I am cold" would become "cold am
>> I" (haha I just realized that's probably how yoda would say it).  So
>> for now I am hard coding my string, so "myString" ="I am cold".
>>
>> How I am thinking of doing this is as follows:
>>
>> (loop [i 0]
>> (when (< i (count myString))
>> //missing code
>> //
>> //
>> (recur (inc i))))
>>
>> so this probably isn't a hard thing to do but like I said I am new to
>> this all.  I basically need to figure out a way to print each element
>> of myString one at a time, this would allow me to figure out how to
>> reverse it.
>>
>> so to my simple question, is it possible it print each element of a
>> string independently?
>>
>> I know about (first myString), which will give me I printed out three
>> times.  So it seems there has to be a way and I just can't seem to
>> figure it out.
>>
>> thanks for any input!
>>
>> -joejoe
> >
>



-- 
R. Mark Volkmann
Object Computing, Inc.

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

Reply via email to