Skip to content

Instantly share code, notes, and snippets.

@ferrous26
Created November 1, 2011 16:51
Show Gist options
  • Select an option

  • Save ferrous26/1331141 to your computer and use it in GitHub Desktop.

Select an option

Save ferrous26/1331141 to your computer and use it in GitHub Desktop.
Demonstrate possible problem with Range -> NSRange transformations
○ macirb
irb(main):001:0> framework 'Cocoa'
=> true
irb(main):002:0> a = (0..10).to_a
=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
irb(main):003:0> a.subarrayWithRange(0..10)
=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
irb(main):004:0> a.slice(0..10)
=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
irb(main):005:0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment