Last active
August 29, 2015 14:26
-
-
Save netzwerg/dca85a8410865b833c3e to your computer and use it in GitHub Desktop.
Behavior of putStr regarding line termination (Haskell vs. Frege vs. Java)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Print where | |
-- Identical to the Haskell version (Print.hs) | |
-- Frege doesn't print line 7 (even a manual stdout.flush afterwards doesn't work) | |
main = do | |
putStrLn "A line with line termination" | |
putStr "A line without line termination, e.g. to prompt for input: " | |
line <- getLine | |
putStrLn ("You entered: " ++ line) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Print where | |
main = do | |
putStrLn "A line with line termination" | |
putStr "A line without line termination, e.g. to prompt for input: " | |
line <- getLine | |
putStrLn ("You entered: " ++ line) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Print { | |
public static void main(String[] args) { | |
System.out.println("A line with line termination"); | |
System.out.print("A line without line termination, e.g. to prompt for input: "); | |
String line = new java.util.Scanner(System.in).nextLine(); | |
System.out.println("You entered: " + line); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment