On Mon, Nov 17, 2008 at 3:48 PM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > On Nov 17, 4:22 pm, samppi <[EMAIL PROTECTED]> wrote: >> Inhttp://groups.google.com/group/clojure/browse_thread/thread/62140a28b..., >> the following example was given: >> >> (defn test1 [{x :x, y :y, :or {:y 3}}] >> [x y]) >> (test1 {:x 2}) => [2 3] >> >> But this doesn't work on the latest Clojure from Subversion I just >> got: >> >> (test1 {:x 2}) => [2 nil] >> >> Was this a feature that was removed? Or should it work? > > That's a typo in the original, should be: > > (defn test1 [{x :x, y :y, :or {y 3}}] > [x y])
Can someone explain what this does? It looks to me like the function named test1 returns a vector containing the values of x and y. Are you suppose to pass a map to the function? Does it take the value for the key :x and put it in the parameter x, and similarly for y? Is the value 3 used for y if the key :y isn't present in the map? I'm still at the point where reading some Clojure code is like trying understand a complicated regular expression. -- R. Mark Volkmann Object Computing, Inc. --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---