Skip to content

[P0] Vector and tuple patterns in match/let silently return () instead of binding #17

@ecto

Description

@ecto

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions