Skip to content

Instantly share code, notes, and snippets.

@simplay
Created September 29, 2015 23:43
Show Gist options
  • Save simplay/c71316bc7b89ad470b5a to your computer and use it in GitHub Desktop.
Save simplay/c71316bc7b89ad470b5a to your computer and use it in GitHub Desktop.
i1 = [1,2,3,4,5]
i2 = (0...(i1.size-1)).inject([]) {|pairs,x| pairs += ((x+1)...i1.size).map {|y| [i1[x],i1[y]]}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment