doc: structure update

Co-authored-by: Sebastian Ullrich <sebasti@nullri.ch>
This commit is contained in:
Siddharth 2021-12-15 17:18:46 +05:30 committed by GitHub
parent 230d6d2cf5
commit 37982c6d5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 }
```