Entries from 2007-01-25 to 1 day
def allpairs xs, ys result = [] xs.each {|x| ys.each {|y| result << yield(x, y) }} result end p allpairs(['h','o','t'], ['d','o','g']){|x,y| x + y} p allpairs([1, 2, 3, 5], [7, 11, 13]){|x,y| x * y} ["hd", "ho", "hg", "od", "oo", "og", "td…