Mark,

You can read some about destructuring in the documentation for the
special form "let":
http://clojure.org/special_forms#let

You can also explore the functionality at the repl:

user=> (destructure '[{x :x, y :y, :or {y 3}} given])
[map__59 given y (clojure.core/get map__59 :y 3) x (clojure.core/get
map__59 :x)]

There might be a case for more generally located documentation about
destructuring, since it is used in various places besides let, though
of course everyone should read the special forms page before
programming Clojure.

- Mark



On Mon, Nov 17, 2008 at 5:17 PM, samppi <[EMAIL PROTECTED]> wrote:
>
> Ah! Thank you.
>
> On Nov 17, 2: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])
>>
>> Rich
> >
>

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

Reply via email to