Created
August 8, 2010 17:10
-
-
Save vito/514272 to your computer and use it in GitHub Desktop.
file writing comparison: The, Scheme, Ruby
This file contains hidden or 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
"writan to the terminal" print | |
with-output-to: "foo.txt" do: { | |
"writan to foo.txt" print | |
} |
This file contains hidden or 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
(display "writan to the terminal\n") | |
(with-output-to-file "foo.txt" | |
(lambda () (display "writan to foo.txt\n"))) |
This file contains hidden or 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
puts "writing to the terminal" | |
File.open("foo.txt", "w") do |f| | |
f.write("writan to foo.txt\n") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment