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))                          (define normal (baz 7 8))

(parameterize ([print-struct #t]) ; default
  (for ([f (list displayln println writeln)])
    (display (~a (object-name f) ", normal: ")) (f normal)
    (display (~a (object-name f) ", transparent: ")) (f transp)
    (display (~a (object-name f) ", prefab     : ")) (f pref)))
(displayln "\n----------- print-struct becomes #f")
(parameterize ([print-struct #f])
  (for ([f (list displayln println writeln)])
    (display (~a (object-name f) ", normal: ")) (f normal)
    (display (~a (object-name f) ", transparent: ")) (f transp)
    (display (~a (object-name f) ", prefab     : ")) (f pref)))



And the output:

displayln, normal: #<baz>
displayln, transparent: #(struct:foo 7 8)
displayln, prefab     : #s(bar 7 8)
println, normal: #<baz>
println, transparent: (foo 7 8)
println, prefab     : '#s(bar 7 8)
writeln, normal: #<baz>
writeln, transparent: #(struct:foo 7 8)
writeln, prefab     : #s(bar 7 8)

----------- print-struct becomes #f
displayln, normal: #<baz>
displayln, transparent: #<foo>
displayln, prefab     : #<bar>
println, normal: #<baz>
println, transparent: #<foo>
println, prefab     : #<bar>
writeln, normal: #<baz>
writeln, transparent: #<foo>
writeln, prefab     : #<bar>

On Mon, Mar 26, 2018 at 11: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.

Reply via email to