[racket] returning values in #lang racket/load

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Sep 17 10:13:54 EDT 2011

At Tue, 13 Sep 2011 15:32:29 +0300, "Jukka Tuominen" wrote:
> I wonder if there's a way to return values in #lang racket/load other than
> specifically printing them out?

Not currently. The `racket/load' language is (currently) intended to be
like `load', which also doesn't print out intermediate results.

> I noticed that side effects (like print, display, GUI) work as usual, but
> there's no actual return value.
> e.g. (in definitions pane)
> (+ 1 2 3) >> _
> (display (+ 1 2 3)) >> 6 (purple rather than blue)

To get blue output, you could write

  ((current-print) (+ 1 2 3))

The `racket/load' implementation is fairly simple, so you could make
your own variant that adds a `(current-print)' wrapper.

Another possibility is that we should add some options to `racket/load'
that would let you turn on printing and maybe set the initial language.

Posted on the users mailing list.