> On Mar 17, 2018, at 9:24 AM, Eric Griffis <ded...@gmail.com> wrote:
> 
> How about a list of identifiers bound to getters or setters? The 
> `extract-struct-info` procedure in Section 5.7 of the Racket Reference 
> appears to give you that.
> 
> Eric

Souned promising, but  it sounds like you have to roll a struct-info first, 
unless I’ve missed something. I did have some fun exploring 5.2 Creating 
Structure Types (the link to Examples for make-struct-field-accessor & 
make-struct-field-mutaor appear to lead you back to the top of the page, but as 
far as I can tell there are no examples there for those functions…) 

No, what I was hoping for was something you could throw a structure instance at 
and obtains a list of its accessors/mutators so that I could then write a 
generalized version of struct-copy (which appears not to copy a struct that has 
#:auto fields. Placing a struct inside of  a define though gives a pretty quick 
glimpse at the underlying code that the (struct ….) generates, and the mutator 
created by make-struct-type is simply thrown away (when not used by 
make-struct-mutator. I would think that between that (if it could be retained) 
and the struct->list function, which produces an index-ordered list of the 
struct’s values, that you could create a struct-copy that would populate all of 
the fields. Of course, you’d have a mutator out in the wild that could always 
modify the struct… no, you’d have to encapsulate all that into a special 
function foo-copy for struct foo, and pass that out with the mutator safely 
encapsulated in a lambda, I supposed

Kevin

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to