Re: explode a string to a list

2009-09-08 Thread Conrad
Never mind- I figured it out looking at the str-utils source... the answer is (apply str [\t \e \s \t]) On Sep 8, 6:05 pm, Conrad wrote: > Although this shows how to convert a string into a seq of chars, for > the life of me I can't find a function in any libraries (or any info > in the newsgro

Re: explode a string to a list

2009-09-08 Thread Conrad
Although this shows how to convert a string into a seq of chars, for the life of me I can't find a function in any libraries (or any info in the newsgroup) to do the reverse, i.e. (\t \e \s \t) => "test"... The closest I can find is (print-str [\t \e \s \t])=>"t e s t" ...can anyone give me a po

Re: explode a string to a list

2009-08-22 Thread clint.laskowski
Thank you all for your replies and your help. I never expected Rich Hickey would respond :-) -- Clint On Aug 22, 9:07 am, Rich Hickey wrote: > On Sat, Aug 22, 2009 at 8:20 AM, Sean Devlin wrote: > > > Welcome to Clojure! > > > A String is a form of a Sequence, so the correct function is seq. >

Re: explode a string to a list

2009-08-22 Thread Sean Devlin
Good point. Obviously java.lang.String doesn't implement any extra interfaces. The correct thing to say is that a String is something seq works on. On Aug 22, 10:07 am, Rich Hickey wrote: > On Sat, Aug 22, 2009 at 8:20 AM, Sean Devlin wrote: > > > Welcome to Clojure! > > > A String is a form o

Re: explode a string to a list

2009-08-22 Thread Rich Hickey
On Sat, Aug 22, 2009 at 8:20 AM, Sean Devlin wrote: > > Welcome to Clojure! > > A String is a form of a Sequence, so the correct function is seq. > I think we all need to be very careful about calling things sequences which are not. seq can give you a sequential view of many things, but that does

Re: explode a string to a list

2009-08-22 Thread Sean Devlin
Welcome to Clojure! A String is a form of a Sequence, so the correct function is seq. user=>(seq "test") (\t \e \s \t) The sequence abstraction is on of may favorite things about Clojure. It is an interface most collections implement, and it makes it very consistent to manipulate any "collectio

Re: explode a string to a list

2009-08-22 Thread Michel Salim
On Sat, 2009-08-22 at 01:54 -0700, clint.laskowski wrote: > What is the best way to iterate through the characters of a string? Is > there some kind of EXPLODE function such that: > > => (explode "test") > (\t \e \s \t) > > I did a Google search but the closest thing I found was SUBS: > > =>(s

Re: explode a string to a list

2009-08-22 Thread Chouser
On Sat, Aug 22, 2009 at 4:54 AM, clint.laskowski wrote: > > Sorry if this is a FAQ. I'm a Clojure newbie. > > What is the best way to iterate through the characters of a string? Is > there some kind of EXPLODE function such that: > > => (explode "test") > (\t \e \s \t) 'seq' creates a sequence ou

explode a string to a list

2009-08-22 Thread clint.laskowski
Sorry if this is a FAQ. I'm a Clojure newbie. What is the best way to iterate through the characters of a string? Is there some kind of EXPLODE function such that: => (explode "test") (\t \e \s \t) I did a Google search but the closest thing I found was SUBS: =>(subs "test" 1 2) "t" --~--~---