0

How can I override

Seq(Seq(1,2), Seq(2,3)).mkString("::")

to return

(1, 2)::(2, 3)

instead of:

List(1, 2)::List(2, 3)

edit

It looks like it boils down to:

Seq((1,2), (2,3)).mkString("::")

how can I convert the nested sequence to tuples? (As this prints nicely without the type identifier). But a tuple would not work Convert a Scala list to a tuple?

Georg Heiler
  • 16,916
  • 36
  • 162
  • 292
  • "Tuple" is XY-distraction. If you want strings, then `map` it to strings in the format that you need, then concatenate with `::` using `mkString`. – Andrey Tyukin Dec 18 '18 at 20:44
  • But how can I get rid of the `List` prefix for each nested list item? – Georg Heiler Dec 18 '18 at 20:45
  • `Seq(Seq(1,2), Seq(2,3)).map(_.mkString("(",", ",")")).mkString("::")` – jwvh Dec 18 '18 at 20:48
  • 1
    In exactly the same way that you can get rid of `StuffYouDontNeed` in `Seq(Seq(1,2), Seq(2,3)).map(_.mkString("StuffYouDontNeed(", ",", ")")).mkString("::")` - if you don't need it, then don't put it into the result string. – Andrey Tyukin Dec 18 '18 at 20:48

0 Answers0