R
Ruby Quiz
The three rules of Ruby Quiz:
1. Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.
2. Support Ruby Quiz by submitting ideas as often as you can:
http://www.rubyquiz.com/
3. Enjoy!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
There's been quite a bit of discussion lately about how much Ruby is and isn't
like Lisp. While I've known of Lisp for some time now, I have never really
taken the time to play with it until just recently. I started with this great
tutorial:
http://www.lisperati.com/casting.html
Of course, just reading it didn't tell me all about the differences between Ruby
and Lisp, so I decided to translate it to Ruby. That taught me a lot, so I
thought I would share.
This week's Ruby Quiz is to translate the game built in the above tutorial into
the equivalent Ruby.
The tutorial is very interactive, so you should probably target irb as your
platform. (I did.) Don't worry about the prose here, we're just translating
the code from the tutorial.
I would say there are probably two extremes for how this can be done. You can
basically choose a direct command-for-command translation or decide to keep the
premise but translate the code to typical Ruby constructs. I think there's
merit to both approaches. I took the direct translation route for instance, and
I had to do a fair bit of thinking when I hit the section on Lisp's macros. On
the flip side, I think it would be great too wrap all the data in Ruby's objects
and use the tutorial to show off concepts like Ruby's open class system. So aim
for whatever approach interests you.
1. Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.
2. Support Ruby Quiz by submitting ideas as often as you can:
http://www.rubyquiz.com/
3. Enjoy!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
There's been quite a bit of discussion lately about how much Ruby is and isn't
like Lisp. While I've known of Lisp for some time now, I have never really
taken the time to play with it until just recently. I started with this great
tutorial:
http://www.lisperati.com/casting.html
Of course, just reading it didn't tell me all about the differences between Ruby
and Lisp, so I decided to translate it to Ruby. That taught me a lot, so I
thought I would share.
This week's Ruby Quiz is to translate the game built in the above tutorial into
the equivalent Ruby.
The tutorial is very interactive, so you should probably target irb as your
platform. (I did.) Don't worry about the prose here, we're just translating
the code from the tutorial.
I would say there are probably two extremes for how this can be done. You can
basically choose a direct command-for-command translation or decide to keep the
premise but translate the code to typical Ruby constructs. I think there's
merit to both approaches. I took the direct translation route for instance, and
I had to do a fair bit of thinking when I hit the section on Lisp's macros. On
the flip side, I think it would be great too wrap all the data in Ruby's objects
and use the tutorial to show off concepts like Ruby's open class system. So aim
for whatever approach interests you.