Skip to content

Instantly share code, notes, and snippets.

@seanhandley

seanhandley/merge.rb

Created Nov 15, 2015
Embed
What would you like to do?
Einstein 15: Merging left_of? with implies?
# Implies
def i(a, b, c, d)
(0..4).any? do |i|
a[i] == b &&
c[i] == d
end
end
# Left of
def l(a, b, c, d)
(0..4).any? do |i|
a[i] == b &&
c[i+1] == d
end
end
# Modify implies? to take a positional modifier
def i(a, b, c, d, o = 0)
(0..4).any? do |i|
a[i] == b &&
c[i+o] == d
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.