Hello, I'm writing some code to manipulate a few structs and in doing so have run into a rub. There doesn't seem to be a convenient way to do functional updates for structs.
Normally I'd use struct-copy, but I have neither the field nor the type name at compile time, currently I have a macro that looks like this (wire some-struct-accessor ; source some-proc ; pipe (lambda (s v) (struct-copy type-name s [field-name v]))) ; sink which just looks clunky when compared to the functional accessor. My research turned up a thread[1] from 2010 that proposed (type-name/field struct val) as an updater counterpart to (type-name-field struct) but that doesn't seem to have gone anywhere. I figured I'd ask to see if I'm about to reinvent the wheel here before I just write some code to generate my update functions. [1] http://lists.racket-lang.org/users/archive/2010-October/042390.html Cheers, Danny Gratzer
____________________ Racket Users list: http://lists.racket-lang.org/users