The relevant lines from htdp-lang.rkt are
> ;; set the global-port-print-handler after the super class because the super
> sets it too
> (lambda ()
> (define my-setup-printing-parameters
> (λ (value port [depth 0])
> my-setup-printing-parameters value settings port 'infinity))))))
For the image library, we built snips into drracket and they know how to
display themselves in the teaching languages. But having gone thru this once, I
doubt you want to do it.
> On Nov 6, 2017, at 11:38 AM, Nadeem Abdul Hamid <nad...@acm.org> wrote:
> How do you control the way objects of a class are printed out in
> BSL/ISL/etc.? I tried implementing the 'printable' interface but all that
> shows up in BSL is
> (instantiate (class ...) ...)
> Here's what I tried:
> ;;; thingy.rkt ===========================
> #lang racket
> (provide make-thingy)
> (define (make-thingy i)
> (new thingy%))
> (define thingy%
> (class* object% (printable<%>)
> (define/public (custom-print out quote-depth)
> (fprintf out "foo"))
> (define/public (custom-write out)
> (fprintf out "foo" ))
> (define/public (custom-display out)
> (fprintf out "foo" ))))
> ;;; if you run just this and type (new thingy%) it displays foo
> ;;; thingy-bsl.rkt ===========================
> ;;; BSL language level
> (require "thingy.rkt")
> (make-thingy 0)
> ;;; this shows (instantiate (class ...) ...) instead of foo
> 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
For more options, visit https://groups.google.com/d/optout.