Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 1.95 KB

head_scratching.md

File metadata and controls

38 lines (27 loc) · 1.95 KB

Scratching my Head

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 AllongeCoffeeScript RistrettoKestrels, Quirky Birds, and Hopeless Egocentricity


Reg Braithwaite | @raganwald