On Sat, Aug 22, 2009 at 2:08 AM, Sigrid <keyd...@gmx.de> wrote:

>
> Hi Meikel, hi all,
>
> thanks for the explanation, I think I got it now. I suppose something
> in the sentence I quoted led me to think that pattern matching was
> "less" in a way than destructuring, whereas in fact it seems to be the
> opposite - pattern matching seems to presuppose destructuring if I'm
> correct now.


Correct, pattern matching is built using destructuring bind.


>
>
> Still then (regarding "The way that Rich elected to de-couple
> destructuring bind from pattern matching was brilliant.") , it is
> unclear to me why it was such a good idea not to include pattern
> matching, or, to somehow keep them separate...


Destructuring is useful all over the place, not just for pattern matching.
For example, it is really useful in function parameter vectors.


>
>
> Ciao,
> Sigrid
>
>
>
>
> On 21 Aug., 21:16, Meikel Brandmeyer <m...@kotka.de> wrote:
> > Hi,
> >
> > Am 21.08.2009 um 20:02 schrieb Sigrid:
> >
> > > Could someone point me to what the difference is? I know pattern
> > > matching e.g. from the PLT scheme implementation, and there the
> > > pattern matching also provides the binding and destructuring I
> > > think...?
> >
> > The difference is, that in pattern matching you can also specify
> > values on the left side. For example in OCaml:
> >
> > type foo = [ Foo of int ];
> >
> > value frobnicate x =
> >         match x with
> >         [ Foo 5 -> do_something ()
> >         | Foo 7 -> do_something_else ()
> >         | Foo x -> do_more x ];
> >
> > (Please bear with me if I don't remember all the details of the syntax.)
> >
> > While this is not possible in Clojure:
> >
> > (let [[x 5 y] [1 2 3]]
> >    ...)
> >
> > The five on the left hand side is not allowed.
> >
> > Hope this helps.
> >
> > Sincerely
> > Meikel
> >
> >  smime.p7s
> > 2KAnzeigenHerunterladen
> >
>

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

Reply via email to