Ruby Koans. Best way to learn Ruby.
rubykoans.com
Ruby Koans. Best way to learn Ruby.
1–10 of 20 posts
Re: Ruby Koans. Best way to learn Ruby.
#2Already posted http://news.ycombinator.com/item?id=1622245
Re: Ruby Koans. Best way to learn Ruby.
#3Going through these would be useful for any Rubyist, not just those learning. I have been using Ruby for a while now and I didn't know there was a difference between string << 'foo' and string += 'foo' until now.
Re: Ruby Koans. Best way to learn Ruby.
#4There are also functional koans. Same idea for some other languages.
http://github.com/relevance/functional-koans
Each of the following languages has its own branch: Clojure, FSharp, Haskell, and Scala.
Re: Ruby Koans. Best way to learn Ruby.
#5There is also a python port available @ http://wiki.github.com/gregmalcolm/python_koans/
Re: Ruby Koans. Best way to learn Ruby.
#6Going through these would be useful for any Rubyist, not just those learning. I have been using Ruby for a while now and I didn't know there was a difference between string << 'foo' and string += 'foo' until now.
[deleted]
Re: Ruby Koans. Best way to learn Ruby.
#7Love it, just what my mind needed to learn better :)
Re: Ruby Koans. Best way to learn Ruby.
#8Going through these would be useful for any Rubyist, not just those learning. I have been using Ruby for a while now and I didn't know there was a difference between string << 'foo' and string += 'foo' until now.
I learned that difference while doing some genetic programming. The difference is quite visible when you do it a few million times.
Re: Ruby Koans. Best way to learn Ruby.
#9 def test_changing_hashes
hash = { :one => "uno", :two => "dos" }
hash[:one] = "eins"
expected = { :one => "eins", :two => "dos" }
assert_equal expected, hash
# Bonus Question: Why was "expected" broken out into a variable
# rather than used as a literal?
end
Can anyone help with the bonus question? From searching Google, I read that the reason: assert_equal { :one => "eins", :two => "dos" }, hash
gives an error is that Ruby believes this to be a block. But then why doesn't it consider the hash to be a block below: expected = { :one => "eins", :two => "dos" }
?Edit: thanks jashkenas for the explanation! Edit2: for anybody else trying these, I think the version in github is more up-to-date, with some corrections:
Re: Ruby Koans. Best way to learn Ruby.
#10Pretentious