Skip to content

Instantly share code, notes, and snippets.

@rubydubee
Created June 30, 2011 22:00
Show Gist options
  • Save rubydubee/1057374 to your computer and use it in GitHub Desktop.
Save rubydubee/1057374 to your computer and use it in GitHub Desktop.
Set Operations on Arrays
#Union
[1,2,3] | [1,4,5] # => [1, 2, 3, 4, 5]
#Intersection
[1,2,3] & [1,4,5] # => [1]
#Difference
[1,2,3] - [1,4,5] # => [2, 3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment