Meikel,
Many thanks: I *knew* there had to be a more succinct way to do it...
think I need to stare at the Clojure API documentation a bit more. :)
Kind regards,
-tree
On Thu, Oct 16, 2008 at 5:48 PM, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Am 16.10.2008 um 23:36 schrieb Tom Emerson:
>
>> 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)))))))
>
> (defn split-line
> [line]
> (let [parts (. line split ":")]
> (list*
> (first parts)
> (partition 2 (rest parts)))))
>
> Sincerely
> Meikel
>
>
--
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 [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
-~----------~----~----~----~------~----~------~--~---