I want to define a function like this:
def mixUp[A](lista: List[A], aprop: Int, listb: List[A], bprop: Int): List[A]
lista
and listb
are two List that has the same generic.
And the aprop
,bprop
meaning the proportion of lista
and listb
that appears.
Assume
val lista = List("1", "2", "3")
val listb = List("a", "b", "c", "d", "e", "f")
Then the result of calling mixUp(lista, 1, listb, 2)
should be
List("1", "a", "b", "2", "c", "d", "3", "e", "f")
And if
val lista = List("1", "2")
val listb = List("a", "b", "c", "d", "e")
The result of mixUp(lista, 1, listb, 2)
should be
List("1", "a", "b", "2", "c", "d", "e")
If
val lista = List("1", "2", "3", "4")
val listb = List("a", "b", "c")
The result of mixUp(lista, 1, listb, 2)
should be
List("1", "a", "b", "2", "c", "3", "4")
How to implement the function?