Question: I have written a flatten function from scratch that takes a nested list as input and outputs another. def flatten[A] (list:List[List[A]]):List[A] I used scala's ':::'
I have written a flatten function from scratch that takes a nested list as input and outputs another.
def flatten[A] (list:List[List[A]]):List[A]
I used scala's ':::' to bind the two lists and it worked fine. However, my exercise prohibits me from using that or any built in method ( exercise from a personal scala book).
Now, i have written a helper method that merges those two list called merge.
How would merge fit in a new version of flatten?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
