clojure.contrib.string has take and drop, which do what you want
(though you have to ask for exactly one character to emulate first/
rest). However, my understanding is that c.c.string is going away in
1.3, and many of its features will be removed rather than moved, so I
don't think you're supposed to use it anymore.

On Dec 8, 11:43 am, Surgo <morgon.kan...@gmail.com> wrote:
> To help myself learn Clojure, I figured I would write a pattern
> matching / destructing macro to better look like languages I'm more
> familiar with; i.e., destructuring by [first|second|rest] instead of
> [first second & rest]. To do this I'm turning the aforementioned
> vector into a string (via str) and looking for / replacing the |
> character. However, this led to the following issue...
>
> (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?

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