As an aside, vectors are intended to be a constant-time access data
structure. Lists aren't so it won't make sense to build vectors on top of
lists which would make for non-constant slot access times.
On Monday, March 26, 2018 at 4:13:02 PM UTC-4, lysseus wrote:
> > On Mar 26, 2018, at 11:03 AM, Eric Griffis <ded...@gmail.com
> > The `struct` form is defined in `struct.rkt` . As you can see,
> `struct` wraps `define-struct/derived` , which uses many things exported
> from `struct.c` . The "Inside: Racket C API" doc  describes some of
> these functions -- see section 16.
> > On the matter of structs being essentially vectors: Again in `struct.c`
> , the C function `scheme_make_struct_instance` (line 2388) instantiates
> a `Scheme_Structure`, which is declared in `schpriv.h` , line 1113. The
> field values go into a `slots` array, which points directly to the
> `Scheme_Object`s (i.e. arbitrary Racket values) supplied to
> `scheme_make_struct_instance`. Assuming Racket vectors are essentially C
> arrays, Racket structs are like vectors in this way.
> > Looking at `Scheme_Struct_Type`, defined just above `Scheme_Structure`
> in `schpriv.h` , it's clear there's nowhere to store field names. We can
> confirm this by looking at `_make_struct_type` in `struct.c` , starting
> at line 4778, as this is the function used (indirectly) by
> > Eric
> Thanks, Eric! So maybe the solution for that would not be rewriting the
> struct definition altogether, but providing that additional information in
> something equivalent to a le over lambda, which would contain that meta
> I ran into an issue that felt similar to this when I was trying to pass
> method names around in Racket objects. I’ve no idea, but I would think the
> “solution” to both issues would be similar. Admittedly, I’ve not dug down
> into either structs or objects deep enough.
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
For more options, visit https://groups.google.com/d/optout.