mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2025-03-07 21:30:25 +00:00
inter an f
This commit is contained in:
parent
7bae8fef9a
commit
942cd78c7d
@ -11,12 +11,12 @@ object Paragraph:
|
||||
Paragraph(xs.toList)
|
||||
|
||||
def mkLines(ps: List[Paragraph]): List[String] =
|
||||
interFlatMap(ps)("", _.xs)
|
||||
interFlatMap(ps)(List(""), _.xs)
|
||||
|
||||
def interFlatMap[A, B](xs: List[A])(x: B, f: A => List[B]): List[B] =
|
||||
def interFlatMap[A, B](xs: List[A])(x: List[B], f: A => List[B]): List[B] =
|
||||
xs match
|
||||
case head :: tail =>
|
||||
f(head) ::: tail.flatMap(a => x :: f(a))
|
||||
f(head) ::: tail.flatMap(a => x ::: f(a))
|
||||
|
||||
case Nil =>
|
||||
Nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user