> On Feb 8, 2017, at 9:05 PM, Philip McGrath wrote:
> Personally, I tend to end up defining helper functions to do functional
> update (often with optional keyword arguments to address the
> fields-that-stay-the-same issue). Generics in the sense of racket/generic can
> be helpful for this if
Note, though, that struct-copy needs to be given the type of the resulting
structure statically, at compile time, and "the result of *struct-expr* can
be an instance of a sub-type of *id*, but the resulting copy is an
immediate instance of *id* (not the sub-type)." [1] If you have a complex
hierarc
Matthias, thanks for the confirmation that macros are the answer. Yes, mutation
could be simpler. I'm learning more doing it functionally.
Alex, thanks for pointing out struct-copy. I hadn't read that part of the
Racket Guide yet.
Would it be possible to write a macro that when invoked within a
3 matches
Mail list logo