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 "#<x:~s>" (name obj))))
  ((id constr pred acc mut)
   (make-struct-type 'x #f 1 0 #f
    (list (cons prop:custom-write printer))))
  ((name) (make-struct-field-accessor acc 0 'name)))
 (constr 'y)) ; -> #<x:y>
 
n ; -> 2
 
;Done with
;DrRacket, version 6.2.0.5--2015-07-06(d6fa581/a) [3m].
;Language: racket [custom]; memory limit: 2000 MB.
 
Best wishes, Jos Koot

-- 
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