On Jan 15, 2:54 pm, wubbie <[email protected]> wrote:
> But in partial desctructuring, [[a [b]] has extra pair of outer-most
> [] which leads to confusion. Any explanation on that?
Extra pair of []? What do you mean?
The destructuring pattern is: [[a [b]] & leftover]
The pattern you're matching is: (("one" ("two")) "three" ((("four"))))
So:
a = "one"
b = "two"
leftover = '("three ((("four"))))
All seems pretty correct to me. Is it just the "&" that's confusing?
> Also not sure about the last (on strings).
Well, if you turn a string into a sequence, you get a sequence of
chars. \a is a char, so (seq "abc") is (\a \b \c).
The destructuring pattern is: [a b c & leftover]
The pattern you're matching is: (\1 \2 \3 \g \o)
So: a = 1, b = 2, c = 3 and leftover = (\g \o)
Does that make things any clearer, or have I just confused you
further? :)
- James
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---