diff options
author | Ryan Lahfa | 2024-05-13 18:10:39 +0200 |
---|---|---|
committer | Ryan Lahfa | 2024-05-13 18:10:39 +0200 |
commit | 001f3553287a51c1704ea3033a44e548440ec108 (patch) | |
tree | c24c553eafb29e2c4ab763aca16b450770654341 /backends/lean | |
parent | 5c758f8b9b70288f3ef428c53122c75677255520 (diff) |
backends/lean: repair definition of `core.mem.replace`
Oops, it is supposed to do something with the second argument!
Signed-off-by: Ryan Lahfa <ryan.lahfa@inria.fr>
Diffstat (limited to 'backends/lean')
-rw-r--r-- | backends/lean/Base/Primitives/Base.lean | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/backends/lean/Base/Primitives/Base.lean b/backends/lean/Base/Primitives/Base.lean index d682e926..c9237e65 100644 --- a/backends/lean/Base/Primitives/Base.lean +++ b/backends/lean/Base/Primitives/Base.lean @@ -134,7 +134,10 @@ def Result.attach {α: Type} (o : Result α): Result { x : α // o = ok x } := -- MISC -- ---------- -@[simp] def core.mem.replace (a : Type) (x : a) (_ : a) : a × a := (x, x) +-- This acts like a swap effectively in a functional pure world. +-- We return the old value of `dst`, i.e. `dst` itself. +-- The new value of `dst` is `src`. +@[simp] def core.mem.replace (a : Type) (dst : a) (src : a) : a × a := (dst, src) /- [core::option::Option::take] -/ @[simp] def Option.take (T: Type) (self: Option T): Option T × Option T := (self, .none) /- [core::mem::swap] -/ |