Re: [racket-users] Struct general question

2018-03-30 Thread Alexander McLin
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

Re: [racket-users] Struct general question

2018-03-26 Thread Kevin Forchione
> On Mar 26, 2018, at 11:03 AM, Eric Griffis wrote: > > The `struct` form is defined in `struct.rkt` [1]. As you can see, `struct` > wraps `define-struct/derived` [2], which uses many things exported from > `struct.c` [3]. The "Inside: Racket C API" doc [5] describes some of these > function

Re: [racket-users] Struct general question

2018-03-26 Thread Kevin Forchione
> On Mar 26, 2018, at 9:36 AM, Jens Axel Søgaard wrote: > > 2018-03-26 17:58 GMT+02:00 Kevin Forchione >: > In another thread on structs it was confirmed that structs are in essence a > vector with some fancy bindings associated. But there must be more going on, > f

Re: [racket-users] Struct general question

2018-03-26 Thread Eric Griffis
The `struct` form is defined in `struct.rkt` [1]. As you can see, `struct` wraps `define-struct/derived` [2], which uses many things exported from `struct.c` [3]. The "Inside: Racket C API" doc [5] describes some of these functions -- see section 16. On the matter of structs being essentially vect

Re: [racket-users] Struct general question

2018-03-26 Thread Jens Axel Søgaard
And here is the racketscript implemenation of structs (also in JavaScript). https://github.com/vishesh/racketscript/blob/master/racketscript-compiler/racketscript/compiler/runtime/core/struct.js 2018-03-26 18:36 GMT+02:00 Jens Axel Søgaard : > 2018-03-26 17:58 GMT+02:00 Kevin Forchione : > >> In

Re: [racket-users] Struct general question

2018-03-26 Thread Shu-Hung You
For controlling custom printing of a struct, you can use `gen:custom-write` generic interface. An example is like the use of make-cosntructor-style-printer: https://docs.racket-lang.org/reference/structutils.html#%28def._%28%28lib._racket%2Fstruct..rkt%29._make-constructor-style-printer%29%29 Unde

Re: [racket-users] Struct general question

2018-03-26 Thread Jens Axel Søgaard
2018-03-26 17:58 GMT+02:00 Kevin Forchione : > In another thread on structs it was confirmed that structs are in essence > a vector with some fancy bindings associated. But there must be more going > on, for instance, the definition (struct foo (A B)) creates a function foo > that when applied doe

Re: [racket-users] Struct general question

2018-03-26 Thread David Storrs
There's this: https://docs.racket-lang.org/reference/printing.html#%28part._print-structure%29 Here's an example: #lang racket (struct foo (A B) #:transparent)(define transp (foo 7 8)) (struct bar (A B) #:prefab)(define pref (bar 7 8)) (struct baz (A B))

[racket-users] Struct general question

2018-03-26 Thread Kevin Forchione
In another thread on structs it was confirmed that structs are in essence a vector with some fancy bindings associated. But there must be more going on, for instance, the definition (struct foo (A B)) creates a function foo that when applied does not print like a vector. Is there any documentati