Scheme offers an astoundingly simple display
function. It takes a single argument and simply prints out whatever is given. This sounds great in theory, but debugging statements, markers and complex screen printing is tiresome with such a limited function.
Someone clever thought up an enhanced version of display
. And after looking at it, you’ll wonder why you hadn’t thought of it and why it is not natively built in.
;; display+ displays all of the values with a newline at the end. (define (display+ . args) (for-each (lambda (item) (display item)) args) (newline))
So, instead of writing something like (display "hello ") (display name) (newline)
, you could just as easily do a more conventional, (display "hello " name)
. This is more akin to the usual type of concatenating that is seen in other languages.