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
Under the hood, the `struct` form is expanded down to the primitive `make-struct-type` API and code for creating associated accessor bindings, mutator bindings and reflection information bindings. In `make-struct-type`, all arguments and configurations are made explicit. For example, `#:transparent` option compiles down to passing #f for the `inspector` argument. You can use the expand function to expand struct definitions and see its underlying implementation: > (pretty-write (syntax->datum (expand '(struct foo (A B))))) (begin ... (define-values (struct:foo foo1 foo? foo-A foo-B) (let-values (((struct: make- ? -ref -set!) (let-values () (let-values () (#%app make-struct-type 'foo '#f '2 '0 '#f null (#%app current-inspector) '#f '(0 1) '#f 'foo))))) ... A struct type can be associated with many struct type properties. The `props` argument is what `#:property` expands down to. With struct type properties, you associate arbitrary data with a struct type (not their instances). The generic method interfaces like `gen:custom-write` also use struct type property to attach custom printing function to a struct type. In David's reply, gen:custom-write is documented as part of the struct printing protocols. Shu-Hung On Mon, Mar 26, 2018 at 10:58 AM, Kevin Forchione <lyss...@gmail.com> wrote: > 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 documentation > instructs that does into the details of what they are and are doing under the > hood? > > 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. -- 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.