On 30 April 2010 18:25, Mark J. Reed <[email protected]> wrote:
[...]
> (defn pairup
> ([a b] (list [a b]))
> ([a b & rest] (cons [a b] (apply pairup rest))))
> I got an error when I tried ([a b]) instead of (list [a b]), by the way:
> Clojure 1.1.0
> user=> (cons [1 2] ([3 4]))
> java.lang.IllegalArgumentException: Wrong number of args passed to:
> PersistentVector (NO_SOURCE_FILE:0)
Well, you didn't *have* to call list. You could have quoted the literal list:
(defn pairup
([a b] '([a b]))
([a b & rest] (cons [a b] (apply pairup rest))))
--
Michael Wood <[email protected]>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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