I have a chained list like
[\"root\", \"foo\", \"bar\", \"blah\"]
And I\'d like to convert it to a list of tuples, using adjacent pairs. Li
One possible solution:
pairs [] = [] pairs (x:[]) = [] pairs (x:y:zs) = (x, y) : pairs (y : zs)
Definitely not as small as yours, and can probably be optimized quite a bit.