The form you're looking for is (defn foo [ & [a b :as c]] ...)
On Jul 27, 2:57 pm, Cameron <cpuls...@gmail.com> wrote: > Hey all, just wondering if this is normal or not. There seems to be > something weird going on with :as in a functions arg vector. > > This little example works as I'd expect... > user=> (defn foo [[a b :as c]] c) > #'user/foo > user=> (foo [1 2]) > [1 2] > > But this one does not > user=> (defn foo [a b :as c] c) > java.lang.Exception: Unsupported binding form: :as (NO_SOURCE_FILE:11) > user=> > > I would expect to call the second example like (foo 1 2) and have it > return [1 2]. > > So if this happens to be expected behavior, is there an idiomatic way > to do destructure args but also refer to them all as one list? -- 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