Update docs and changelog
This commit is contained in:
parent
0d6bcf688b
commit
27e2170545
@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- `Set` stdlib
|
||||
- `Option.force_msg`
|
||||
- Loading namespaces into the current scope (e.g. `using Pair`)
|
||||
- Assign patterns to variables
|
||||
- Assign patterns to variables (e.g. `let x::(t = y::_) = [1, 2, 3, 4]` where `t == [2, 3, 4]`)
|
||||
### Changed
|
||||
### Removed
|
||||
|
||||
|
@ -471,6 +471,17 @@ function
|
||||
get_left(Both(x, _)) = Some(x)
|
||||
```
|
||||
|
||||
Sophia also supports the assignment of patterns to variables:
|
||||
```sophia
|
||||
function f(x) = switch(x)
|
||||
h1::(t = h2::_) => (h1 + h2)::t // same as `h1::h2::k => (h1 + h2)::h2::k`
|
||||
_ => x
|
||||
|
||||
function g(p : int * option(int)) : int =
|
||||
let (a, (o = Some(b))) = p // o is equal to Pair.snd(p)
|
||||
b
|
||||
```
|
||||
|
||||
*NOTE: Data types cannot currently be recursive.*
|
||||
|
||||
## Lists
|
||||
|
Loading…
x
Reference in New Issue
Block a user