Hey, this is my blog

It is somewhat abandoned.

More Scala Groups And Tuples

Continuing from here, I have lists of tuples and I want to group them. Here I have a list of 4-tuples and I want to group the second tuple by the first. The fact that I need to do this probably represents some greater problem, but that is a story for another time

That was easy. The use of head and drop from shapeless lets you act on tuples like they are lists. However abstracting away the size of the tuples gets tricky, because we need type annotations to make the compiler happy.

Here is the same implementation for 5-tuples:

The interesting thing here is that, except for type annotations, these definitions are exactly the same.

To be continued…