[plt-scheme] Re: What is the type of the "hello_world" function in Typed Scheme?
Benjamin Russell wrote:
> A minor point: The result is identical, whether "\n" appears at the
> end of the displayed string, or not. I got the same result with
> "printf" as well. With "write," the "\n" is displayed as the escape
> sequence itself (rather than the newline indicated by the escape
> sequence) if specified.
>
> Do you know any way to display exactly the characters specified in the
> argument string, without automatically appending a newline at the end?
You're running this in DrScheme, right? I think you're seeing this
because DrScheme automatically moves to a newline when it puts the
prompt up in the interactions window. Newlines are printed as
prescribed except on the last line of output from your function/
program. Here's a demo:
#lang typed-scheme
(display "Hi")
(display "Hi\n")
(display "Hi\n\n")
(display "Hi\n\n\n")
(display "Hi\n\n\n\n")
when I run this program in DrScheme I get the following (comments
added afterwards):
HiHi ; <- No newline here
Hi
Hi
Hi
> ; <- DrScheme prompt
I think if you were to run your code from the command line, everything
would work as expected.
-- Dave