The Pattern Matching guide shows vector destructuring in both
match and let:
[match pair
#[0 _] "starts with zero"
...]
[let #[a b c] #[1 2 3]]
[println b] ; "2"
Under loon run (0.6), these forms return () instead of matching
or binding. Only constructor patterns ([Foo x]), literal patterns,
wildcard, and plain binding work in match; vector and map
destructuring only work in lambda parameters ([fn [[a b]] x]).
Acceptance criteria
- Implement
#[...] patterns in match and let so the guide samples
run verbatim, or remove them from the guide and steer readers
to lambda-param destructuring.
- Add tests for whichever direction is chosen.
Found while completing the hyperpolyglot ml column (clarkgrubb/hyperpolyglot#139).
The Pattern Matching guide shows vector destructuring in both
matchandlet:Under
loon run(0.6), these forms return()instead of matchingor binding. Only constructor patterns (
[Foo x]), literal patterns,wildcard, and plain binding work in
match; vector and mapdestructuring only work in lambda parameters (
[fn [[a b]] x]).Acceptance criteria
#[...]patterns inmatchandletso the guide samplesrun verbatim, or remove them from the guide and steer readers
to lambda-param destructuring.
Found while completing the hyperpolyglot ml column (clarkgrubb/hyperpolyglot#139).