So this string-splitting function works but it doesn't look very
aesthetic and returns a list of lists of \char.
I know I can do (map str list) to turn the chars(?) into strings again
but how do I append them?
And can it be made to look nicer? I don't find it very readable.
(defn split [str delim]
(loop [s str c (first delim) f nil acc nil]
(cond
(empty? s)
(reverse (cons (reverse f) acc))
(not (= c (first s)))
(recur (rest s) c (cons (first s) f) acc)
:else
(recur (rest s) c nil (cons (reverse f) acc)))))
btw, anyone know how to set default intendation to 4 chars instead of
2?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---