split is working fine, returns the parts on both sides of the
delimiter.
but for some reason splitall doesnt, it just does what split does.

(also, what si the best way to deal with strings in clojure, java-
strings?)

(defn split [str delim]
    (loop [s str acc nil]
        (cond
           (= s nil)
               (reverse acc)
           (not (= delim (first s)))
              (recur (rest s) (cons (first s) acc))
           :else
               (list (reverse acc) (rest s)))))


(defn splitall [str delim]
    (loop [s str acc nil]
        (if (= s nil)
            (reverse acc)
            (let [parts (split s delim)]
                (recur (rest parts) (cons (first parts) acc))))))


(defn splitall [str delim]
    (loop [s str acc nil]
        (if (= s nil)
            (reverse acc)
            (recur (rest (split s delim))
                   (cons (first (split s delim)) acc)))))
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to