Hello all,

I wrote a function that behaves as:

user> (split-line "785:3:39334:1:43103")
("785" ("3" "39334") ("1" "43103"))

I'd like to solicit comments on better ways I could have written it:

(defn- split-line
  [line]
  (let [parts (seq (.split line ":"))]
    (loop [mills (drop 1 parts)
           result (list (first parts))]
      (if (nil? mills)
        (reverse result)
        (recur (drop 2 mills) (conj result (take 2 mills)))))))

Thanks in advance for your time,

    -tree

-- 
Tom Emerson
[EMAIL PROTECTED]
http://www.dreamersrealm.net/~tree

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