I would like to functionally derive this input/output pattern:
>>> foo( (2, 3, 4, 5) )
[(2, 3), (3, 4), (4, 5)]
The idea is that the second element of the previous tuple is repeated as the first element of the next tuple. I can't get it any other way than using iterative paradigms.
For what it's worth, I'm trying to answer this question, and I also have to demonstrate functional Python at a meetup next month. So help me kill two birds with one stone please, and thanks!