You can use a map destructuring form on a vector like so: (let [{x 0 y 1 :or {x 0 y 0}} [7]] [x y])
returns [7 0] On Fri, Apr 12, 2013 at 5:00 PM, henry clifford <h.a.cliff...@gmail.com> wrote: > I'm trying to use the :or destructuring syntax as seen here applied to a map > > (def point {:y 7}) > (let [{:keys [x y] :or {x 0 y 0}} point] > (println "x:" x "y:" y)) > x: 0 y: 7 > > but I can't get this to work with vectors: > > (def point [7]) > (let [[x y :or [0 0]] point] > (println "x:" x "y:" y)) > > what' I'm expecting is x:7 y:0 > > but I'm getting Exception Unsupported binding form: :or > > Any thoughts on this? > Thanks! > > -- > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- http://elhumidor.blogspot.com/ -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.