[racket] [plai] consistent output

From: Eric Tanter (etanter at dcc.uchile.cl)
Date: Sun Nov 20 07:31:02 EST 2011

Hi,

By default, #lang plai prints out values as follows in the REPL:

(define-type Foo
  (foo (x number?)))

> (foo 1)
(foo 1)
> (list 1 2)
'(1 2)

The output is not really consistent, in that foo is printed as a (user-level) constructor, but list is not. For teaching, the problem with output '(1 2) is the need to explain (or try to ignore) the quote.

If I change the output configuration to "constructor", then I get:

> (foo 1)
(make-foo 1)
> (list 1 2)
(list 1 2)

Now list is printed as constructor, but foo is printed using its "low-level" constructor, which for teaching is not that great either.

The other option for output is "write", which gives:

> (foo 1)
#(struct:foo 1)
> (list 1 2)
(1 2)

Again not so nice.
Basically, there seems to be no way to obtain:

> (foo 1)
(foo 1)
> (list 1 2)
(list 1 2)

Is there? 
>From a teaching perspective, the above would be quite desirable.
If I remember correctly, some years ago, that was the output in the plai language. It changed at some point.

Thanks,

-- Éric



Posted on the users mailing list.