On Wed, Dec 8, 2010 at 2:00 PM, Laurent PETIT <laurent.pe...@gmail.com>
wrote:
>> (def test "abc")
>> (first test)
>> > \a
>> (rest test)
>> > (\b \c)
>> (string? (rest test))
>> > false
>>
>> It would be really helpful if first/rest returned strings (or a
>> character in the case of first), not lists, when given string input.
>> Is there a design reason for the current behaviour and, if so, are
>> there equivalent built-in functions that do the right thing for
>> strings?
>
> (first "abc") gives you a character.
>
> (rest anything) returns a seq, by definition. It's not about Strings, it's
> the contract of rest. A String is not a seq, but it's viewable as a seq,
in
> which case each element of the seq will be a character of the String.

This behaviour would be a lot easier to deal with if into worked with
strings.

-Phil

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