|
Immutably updating objects
Vladimir Nikishkin
(31 Oct 2022 01:36 UTC)
|
|
Re: Immutably updating objects
Arthur A. Gleckler
(31 Oct 2022 03:57 UTC)
|
|
Re: Immutably updating objects
Marc Nieper-Wißkirchen
(31 Oct 2022 10:08 UTC)
|
|
Re: Immutably updating objects siiky (31 Oct 2022 10:18 UTC)
|
|
Re: Immutably updating objects
Marc Nieper-Wißkirchen
(31 Oct 2022 10:53 UTC)
|
|
Re: Immutably updating objects
Vladimir Nikishkin
(31 Oct 2022 12:54 UTC)
|
|
Re: Immutably updating objects
Marc Nieper-Wißkirchen
(31 Oct 2022 13:09 UTC)
|
|
Re: Immutably updating objects
Vladimir Nikishkin
(03 Nov 2022 02:12 UTC)
|
|
Re: Immutably updating objects
Marc Nieper-Wißkirchen
(03 Nov 2022 07:13 UTC)
|
|
Re: Immutably updating objects
Vladimir Nikishkin
(03 Nov 2022 08:56 UTC)
|
|
Re: Immutably updating objects
Marc Nieper-Wißkirchen
(03 Nov 2022 13:17 UTC)
|
If I understood correctly, I believe the CHICKEN egg typed-records[0]
has just that feature.
(defstruct foo x y z)
This defines a type `foo` with fields `x`, `y` & `z`. Other than the
constructor, getters, and setters, it creates also an `update-foo` that
works like this:
(let* ((foo (make-foo x: 1 y: 2 z: 3))
(foo (update-foo foo x: 4)))
(foo-x foo)) ;=> 4
[0]: https://wiki.call-cc.org/eggref/5/typed-records