Probably history is involved here, as pretty-print long predates print.
DrRacket is controlling the parameter settings of print, probably too
tightly. Probably DrRacket should take care to do that only when it is
doing printing for the REPL and not all uses of print, but I'm less
sure of that than
Looking at this a little bit more, it appears pretty-print has its own
mechanism for controlling reader abbreviations, in the form of
pretty-print-abbreviate-read-macros. Oddly enough, setting this to #f still
causes DrRacket to use abbreviations.
> (print-as-expression #f)
> (pretty-print-abbr
> My guess is that the right thing would be to make pretty-print react to those
> parameters the way print does but I'm not completely certain.
That sounds right. The documentation for pretty-print already lists this:
> In addition to the parameters defined in this section, pretty-print conform
DrRacket sets the global-port-print-handler to use pretty-print (line
605 in language.rkt) instead of just print. My guess is that the right
thing would be to make pretty-print react to those parameters the way
print does but I'm not completely certain. Anyway, here's a rough
approximation to what
When using DrRacket, the following program prints this output, which surprises
me:
> (print-as-expression #f)
> (print-reader-abbreviations #f)
> (print '(1 ,2 3))
(1 ,2 3)
Evaluating the same thing from the CLI gives me the result I'd expect:
-> (print-as-expression #f)
-> (print-reader-abbrev
5 matches
Mail list logo