Skip to content

Instantly share code, notes, and snippets.

@edipofederle
Created November 18, 2021 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edipofederle/621db8218f37b77dfd021cbe7827b3a6 to your computer and use it in GitHub Desktop.
Save edipofederle/621db8218f37b77dfd021cbe7827b3a6 to your computer and use it in GitHub Desktop.
https://github.com/ruby/ruby/blob/master/enumerator.c#L3454 (rb_arithmetic_sequence_beg_len_step)
https://github.com/ruby/ruby/blob/master/enumerator.c#L3429 (rb_arithmetic_sequence_extract)
p [0,1,2,3,4][(3..).step(-2)] #=> {begin = 8, end = 7, step = 18446744073709551615, exclude_end = 0}
p [0,1,2,3,4,5][(2..).step(-3)] #=> {begin = 8, end = 7, step = 18446744073709551615, exclude_end = 0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment