I am trying to zip multiple sequences to form a long tuple:
val ints = List(1,2,3)
val chars = List(\'a\', \'b\', \'c\')
val strings = List(\"Al
Using shapeless, you could do:
import shapeless.Tuples._
val ints = (1, 2, 3)
val chars = ('a', 'b', 'c')
val megatuple = (ints, chars)
val megahlist = (megatuple hlisted) map hlisted
val transposed = (mhlist transpose) map tupled tupled
scala> transposed
res: ((Int, Char), (Int, Char), (Int, Char)) = ((1,a),(2,b),(3,c))
(not sure, if there are more implicts defined which lets you avoid the map and back-and-forth conversions)
[Edit: This part is not true anymore.
Note that the shapeless docs say, only conversions up to Tuple4 are currently supported. You’d have to manually create the HLists then.]