Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Char values not displayed correctly #196

Open
justinethier opened this issue Oct 24, 2014 · 1 comment
Open

Char values not displayed correctly #196

justinethier opened this issue Oct 24, 2014 · 1 comment

Comments

@justinethier
Copy link
Owner

Noted in an email from Rohan Drape:

ps. i don't think showVal prints the Char type in the usual way?

ikarus> (string-ref "test" 1)
#\e

huski> (string-ref "test" 1)
e

Note that it may be desirable for (display #\e) to output e and for (write #\e) to output #\e, as per other Schemes. Tested with Chicken and Bigloo.

@justinethier
Copy link
Owner Author

From the Scheme specs:

library procedure: (write obj)
library procedure: (write obj port)
Writes a written representation of obj to the given port. Strings that appear in the written representation are enclosed in doublequotes, and within those strings backslash and doublequote characters are escaped by backslashes. Character objects are written using the #\ notation. Write returns an unspecified value. The port argument may be omitted, in which case it defaults to the value returned by current-output-port.

library procedure: (display obj)
library procedure: (display obj port)
Writes a representation of obj to the given port. Strings that appear in the written representation are not enclosed in doublequotes, and no characters are escaped within those strings. Character objects appear in the representation as if written by write-char instead of by write. Display returns an unspecified value. The port argument may be omitted, in which case it defaults to the value returned by current-output-port.

  • Rationale: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant