schemeracketpretty-printdr.racket

Sentence output is vertical with line breaks in-between each word


If a sentence of words is too long, the interpreter will print the sentence vertically with line breaks in-between each word, rather than with just one line break when the sentence reaches the edge of the buffer.

> '(one two three four five six seven eight nine ten eleven twelve thirteen 
fourteen fifteen sixteen seventeen eighteen nineteen twenty)
=> '(one
  two
  three
  four
  five
  six
  seven
  eight
  nine
  ten
  eleven
  twelve
  thirteen
  fourteen
  fifteen
  sixteen
  seventeen
  eighteen
  nineteen
  twenty)
> 

How do I get a line with only one or two breaks in it? Like so:

> '(one two three four five six seven eight nine ten eleven twelve thirteen 
fourteen fifteen sixteen seventeen eighteen nineteen twenty)
=> '(one      two      three      four      five      six
  seven      eight      nine      ten      eleven      twelve
  thirteen      fourteen      fifteen      sixteen      seventeen
  eighteen      nineteen      twenty)
> 

or similar?

I'm writing with #lang simply-scheme in DrRacket.


Solution

  • Since Simply Scheme uses lists of symbols as sentences of words there is no solution for this.

    Lists in data contexts are listed either in one line or one element align if the width does not suffice, exactly as you have described in your post. Racket is just following best practices.

    The only solution will be to increase the width to accommodate a whole list in one line. In most apps I have CTRL + - will reduce the font size.