Arc Forumnew | comments | leaders | submitlogin
2 points by fallintothis 5604 days ago | link | parent

As you say, using write may be the thing to do. It's good to raise these questions, though, as there's no particularly "right" answer. write and disp compile to Scheme's write and display, for which R5RS gives the rationale (http://schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-9...):

  Write is intended for producing machine-readable output and display is for
  producing human-readable output. Implementations that allow "slashification"
  within symbols will probably want write but not display to slashify funny
  characters in symbols.
Where "slashification" looks like

  arc> (do (write 'a\ b) (prn))
  |a b|
  nil
  arc> (do (disp 'a\ b) (prn))
  a b
  nil
The quote issue raises consistency questions:

  arc> (prn "quotes don't show here")
  quotes don't show here
  "quotes don't show here"
  arc> (prn (list "so should they really show here...?"))
  (so should they really show here...?)
  ("so should they really show here...?")
It makes sense that disp doesn't print the quotes in the second example: it doesn't in the first, and the output isn't meant to be read back in by the machine, unlike write's output. But there's nothing obviously wrong with it printing the quotes, either.