1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-24 17:27:18 +00:00

Merge pull request #757 from subsetpark/document-match

Add documentation of @ pattern in match
This commit is contained in:
Calvin Rose 2021-08-08 12:51:00 -05:00 committed by GitHub
commit a38cb5df18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1666,6 +1666,10 @@
* `_` symbol -- the last special case is the `_` symbol, which is a wildcard * `_` symbol -- the last special case is the `_` symbol, which is a wildcard
that will match any value without creating a binding. that will match any value without creating a binding.
While a symbol pattern will ordinarily match any value, the pattern `(@ <sym>)`,
where <sym> is any symbol, will attempt to match `x` against a value
already bound to `<sym>`, rather than matching and rebinding it.
Any other value pattern will only match if it is equal to `x`. Any other value pattern will only match if it is equal to `x`.
``` ```
[x & cases] [x & cases]