RE: [racket-users] custom-print called twice?

2015-09-02 Thread Jos Koot
Thanks for the answer, rapid as always. Jos -Original Message- From: Matthew Flatt [mailto:mfl...@cs.utah.edu] Sent: miércoles, 02 de septiembre de 2015 2:11 To: Jos Koot Cc: 'racket users'; jos.k...@gmail.com Subject: Re: [racket-users] custom-print called twice? The first call

Re: [racket-users] custom-print called twice?

2015-09-01 Thread Matthew Flatt
The first call is to detect sharing, and the second time is to actually print. For example, if you change `(constr 'y)` to (define b (box #f)) (set-box! b (constr b)) b then you'll see that the output starts with "#0=", because the first pass detected that a "#0#" will be needed. At Wed,

[racket-users] custom-print called twice?

2015-09-01 Thread Jos Koot
Question: why is in the following example the custom-printer called twice? #lang racket (define n 0) (letrec-values (((printer) (λ (obj port mode) (set! n (add1 n)) (fprintf port "#" (name obj ((id constr pred acc mut) (make-struct-type 'x #f 1 0 #f (list