Closed entropylost closed 3 months ago
with
expressions to not shadow anything.. You'd write the above as let a = ... in a with x = 2.0
.
@athas huh, I suppose that does work. My issue with that is that I sometimes want to update multiple variables at once, but that's quite minor.
You can chain with
: a with x = 1 with y = 2
.
Alright thanks.
If I have a large record, I'd like to be able to create a new record with some elements changed without having to write out all elements of the record. For example,
should be equivalent to
It seems like this was a feature a while back according to https://futhark-lang.org/blog/2017-03-06-futhark-record-system.html, but it seems to have been dropped and the current documentation does not state an alternative except use of
with
statements, but I would prefer to avoid the shadowing that it provides.