doc: structure update
Co-authored-by: Sebastian Ullrich <sebasti@nullri.ch>
This commit is contained in:
parent
230d6d2cf5
commit
37982c6d5c
1 changed files with 8 additions and 1 deletions
|
|
@ -217,4 +217,11 @@ def msg2 : MessageExt where
|
|||
|
||||
## Updating structure fields
|
||||
|
||||
TODO
|
||||
Structure fields can be updated using `{ <struct-val> with <field> := <new-value>, ... }`:
|
||||
|
||||
```lean
|
||||
# structure Point (α : Type u) where
|
||||
# x : α
|
||||
# y : α
|
||||
def incrementX (p : Point Nat) : Point Nat := { p with x := p.x + 1 }
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue