[plt-scheme] Specifics on how display works..

From: Richard Cobbe (cobbe at ccs.neu.edu)
Date: Sun Apr 24 07:11:13 EDT 2005

On Sun, Apr 24, 2005 at 12:38:48AM -0500, Jim Witte wrote:
> Hi, 
> 
> The following display statement will run, display a complicated list 
> like I want (a representation of an FSM in a program I'm writing" 
> 
> (display '(["Stop at a B" "AB" 2] 
>            [('first [('A 'first 'right) 
>                      ('B 'second 'right)]) 
>             ('second [('A ("Found a B")) 
>                       ('B ("Found a B"))])]) ) 
>  
> but this will not, treating part of it as a procedure application, not 
> a list: 
> 
> (display '[["Stop at a B" "ABC" 2] 
>            [('first [('A 'first 'right) 
>                      ('B 'second 'right)]) 
>             ('second [('A ("Found a B")) 
>                       ('B ("Found a B"))])]] ) 

I just cut-and-pasted your second example into DrScheme 299.102, and it
printed the following to standard output, as expected:

((Stop at a B ABC 2) (('first (('A 'first 'right) ('B 'second 'right))) ('second (('A (Found a B)) ('B (Found a B))))))

So I'm not able to reproduce your problem.  Are you sure this is the
only difference between the two in the original code?

On a separate note, if this output is intended to be human-readable, you
may want to look at the pretty-printing library.  Search for pretty.ss
in the helpdesk.

Richard



Posted on the users mailing list.