>From your email below, Matthew, I get the impression that you think some of this can't be fixed inside the PLAI language itself, because there's no other option at the Racket level. Is that correct?<div><br></div><div>
Jay<br><br><div class="gmail_quote">On Sun, Nov 20, 2011 at 7:48 AM, Matthew Flatt <span dir="ltr"><<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">At Sun, 20 Nov 2011 09:31:02 -0300, Eric Tanter wrote:<br>
> By default, #lang plai prints out values as follows in the REPL:<br>
><br>
> (define-type Foo<br>
> (foo (x number?)))<br>
><br>
> > (foo 1)<br>
> (foo 1)<br>
> > (list 1 2)<br>
> '(1 2)<br>
><br>
> The output is not really consistent, in that foo is printed as a (user-level)<br>
> constructor, but list is not.<br>
<br>
</div>Well, `quote' is playing the role of constructor.<br>
<div class="im"><br>
> For teaching, the problem with output '(1 2) is<br>
> the need to explain (or try to ignore) the quote.<br>
<br>
</div>PLAI uses `quote' for lists starting on page 8, so if you're teaching<br>
with the book, it may not be worthwhile to avoid `quote'.<br>
<br>
I think my students has had little trouble with `quote'. In contrast,<br>
in the bad old days when the `quote' was missing --- so that `(list 1<br>
2)' printed as just `(1 2)' --- students had a difficult time with the<br>
difference between expressions and printed values.<br>
<div class="im"><br>
> If I change the output configuration to "constructor", then I get:<br>
><br>
> > (foo 1)<br>
> (make-foo 1)<br>
> > (list 1 2)<br>
> (list 1 2)<br>
><br>
> Now list is printed as constructor, but foo is printed using its "low-level"<br>
> constructor, which for teaching is not that great either.<br>
<br>
</div>Agreed --- this should be fixed.<br>
<br>
Currently, constructor-style printing always uses a "make-", but the<br>
default mode should be to use the same constructor name that `print'<br>
uses when `print-as-expression' is true.<br>
<div class="im"><br>
> The other option for output is "write", which gives:<br>
><br>
> > (foo 1)<br>
> #(struct:foo 1)<br>
> > (list 1 2)<br>
> (1 2)<br>
><br>
> Again not so nice.<br>
<br>
</div>Agreed --- definitely not the right option for teaching.<br>
<div class="im"><br>
> Basically, there seems to be no way to obtain:<br>
><br>
> > (foo 1)<br>
> (foo 1)<br>
> > (list 1 2)<br>
> (list 1 2)<br>
><br>
> Is there?<br>
<br>
</div>Right -- not until we fix constructor-style printing.<br>
<div><div></div><div class="h5"><br>
_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Jay McCarthy <<a href="mailto:jay@cs.byu.edu" target="_blank">jay@cs.byu.edu</a>><br>Assistant Professor / Brigham Young University<br><a href="http://faculty.cs.byu.edu/~jay" target="_blank">http://faculty.cs.byu.edu/~jay</a><br>
<br>"The glory of God is Intelligence" - D&C 93<br>
</div>