AdvancedOpenWater:~ raganwald$ irb
irb(main):001:0> 1 <=> 2
=> -1
irb(main):002:0> [1,2] <=> [1,2]
=> 0
irb(main):003:0> [1,2] <=> [1,1]
=> 1
irb(main):004:0> [1,2] <=> [2,1]
=> -1
So far so good, I think I understand how Ruby's Array class implements the "boat" operator. Which implies something about ordering arrays. Let's confirm my understanding:
irb(main):005:0> [1,2] < [2,1]
NoMethodError: undefined method `<' for [1, 2]:Array
from (irb):5
from :0
Ha! As Pete Forde puts it, "Nothing about Ruby surprises me any more."
My recent work:
- JavaScript Allonge, CoffeeScript Ristretto, and my other books.
- Method Combinators, a CoffeeScript/JavaScript library for writing method decorators, simply and easily.
- Katy, a library for writing fluent CoffeeScript and JavaScript using combinators.
- jQuery Combinators, what else? A jQuery plugin for writing your own fluent, jQuery-like code.