Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Print and Display

Tags:

scheme

PLT Scheme's documentation says:

The rationale for providing print is that display and write both have relatively standard output conventions, and this standardization restricts the ways that an environment can change the behavior of these procedures. No output conventions should be assumed for print, so that environments are free to modify the actual output generated by print in any way.

Could somebody please explain what that means for a noob and how is print and display different?

like image 723
unj2 Avatar asked Jun 05 '09 16:06

unj2


1 Answers

The thing is that programs can expect certain output formats from write and display. In PLT, it is possible to change how they behave, but a little involved to do so. This is intentional, since doing such a change can have dramatic and unexpected result.

OTOH, changing how print behaves is deliberately easy -- just see the current-print documentation. The idea is that print is used for debugging, for presenting code to you in an interactive REPL -- not as a tool that you will rely on for output that needs to be formatted in a specific way. (BTW, see also the "~v" directive for format, printf, etc.)

like image 181
Eli Barzilay Avatar answered Oct 03 '22 14:10

Eli Barzilay