If I have an array of arrays:
[[1, "foo"], [2, "bar"], [3, "foo"], [4, "foo"], [5, "bar"], [6, "baz"]]
How can I eliminate the repeated values, keeping the ones at the END of the array, resulting in:
[[4, "foo"], [5, "bar"], [6, "baz"]]
Thanks!
I have tried numerous approaches, such as following absurd lines, with no success.
a.delete_if {|q| q if q[1] in a} # syntax error
a.each {|q| q.shift if q[1] in a[q][1]} # syntax error
and many more . . .