I'm pounding my head against the wall trying to understand how to do a
simple task. What I want to do is write a function that will take a
even-numbered set of numbers and split them into pairs.

What I have right now is the following

user> (defn pairup  ([a b] [a b])([a b & rest]   (cons (pairup  a b)
(apply  pairup  rest)))   ([] [] ))
#'user/pairup
user> (pairup 1 2 3 4 5 6 7 8)
([1 2] [3 4] [5 6] 7 8)
user>


I can't get the last pair into a vector like the others.

Can someone tell me what I am doing wrong? I know there is probably a
way using the language to do this but I ended up trying to do it from
scratch as a learning exercise.

Thanks

John

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