Skip to content

Instantly share code, notes, and snippets.

@kevinclark
Created December 30, 2008 23:54
Show Gist options
  • Save kevinclark/41813 to your computer and use it in GitHub Desktop.
Save kevinclark/41813 to your computer and use it in GitHub Desktop.
[1,2,5,6,8,9,11].inject([-2,[]]){|d,i|(i==d[0]+1)? (d[-1][-1]<<i;d):[i,d[-1]<<[i]]}[-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment