Re: [racket-users] struct-copy question

2018-03-21 Thread Eric Griffis
On Wed, Mar 21, 2018 at 4:43 PM Alexis King wrote: > > On Mar 21, 2018, at 15:32, Eric Griffis wrote: > > > > This would be a code smell if I didn't trust that our Racket ancestors > > knew what they were doing, so the notion of "fixing" structs (or even > > struct-copy) seems misguided. > > > >

Re: [racket-users] struct-copy question

2018-03-21 Thread Alexis King
> On Mar 21, 2018, at 15:32, Eric Griffis wrote: > > This would be a code smell if I didn't trust that our Racket ancestors > knew what they were doing, so the notion of "fixing" structs (or even > struct-copy) seems misguided. > > [snip] > > I can appreciate the architectural decision that str

Re: [racket-users] struct-copy question

2018-03-21 Thread Eric Griffis
I bump into struct subtleties all the time. For example, my attempts to #:auto always degenerate into custom constructor procedures; This usually involves #:constructor-name and #:omit-define-syntaxes, which might not be a big deal if I had a solid understanding of what these flags actually do. So

Re: [racket-users] struct-copy question

2018-03-20 Thread Kevin Forchione
Just read your GitHub link and see the problem goes beyond my simple #:auto issue. Thanks for that link. I’m pretty green to all the thorny issues when it comes to dressing primitive datatypes up in fancy bindings and hope the magicians of indirection can somehow pull a rabbit out of the hat on

Re: [racket-users] struct-copy question

2018-03-20 Thread Kevin Forchione
On Mar 20, 2018, at 9:21 AM, Kevin Forchione wrote: > > Sorry, wrong example! >(struct fish (color (weight #:auto)) #:transparent) >(define marlin (fish 'orange-and-white)) >(define dory (struct-copy fish marlin [color 'blue])) ../../Applications/Racket/collects/racket/private/define-struct.r

Re: [racket-users] struct-copy question

2018-03-20 Thread Kevin Forchione
On Mar 19, 2018, at 2:35 PM, Alexis King wrote: > > I’m late to this thread, but perhaps I can clarify some things that I > don’t think have been made entirely clear. > > First of all, you are absolutely correct that structures, at runtime, > know nothing whatsoever about field names. At runtim

Re: [racket-users] struct-copy question

2018-03-19 Thread Alexis King
I’m late to this thread, but perhaps I can clarify some things that I don’t think have been made entirely clear. First of all, you are absolutely correct that structures, at runtime, know nothing whatsoever about field names. At runtime, structures are fancy vectors; the names provided for their f

Re: [racket-users] struct-copy question

2018-03-19 Thread Eric Griffis
Does this help? ``` (define-syntax (dump-struct-info stx) (syntax-case stx () [(_ info) (pretty-write `(GOT ,(extract-struct-info (syntax-local-value #'info (λ () #f) #'(void)])) ``` Then we can do: ``` > (struct point (x y [z #:auto #:mutable]) #:transparent) > (dump-s

Re: [racket-users] struct-copy question

2018-03-17 Thread Kevin Forchione
> On Mar 17, 2018, at 9:24 AM, Eric Griffis 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 stru

Re: [racket-users] struct-copy question

2018-03-17 Thread Eric Griffis
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 On Fri, Mar 16, 2018 at 2:56 PM Kevin Forchione wrote: > > > > On Mar 16, 2018, at 2:38 PM, Kevin Forchione wrote: > > > > Hi

Re: [racket-users] struct-copy question

2018-03-16 Thread Kevin Forchione
> On Mar 16, 2018, at 2:38 PM, Kevin Forchione wrote: > > Hi guys, > I’ve noticed that struct-copy doesn’t appear to work when fields are defined > with #:auto. So this leads to my question, which may not be answerable since > it would presumably be used to fix struct-copy, but is there a wa