Hacker News new | ask | show | jobs
by richcollins 5400 days ago
I guess what I meant to ask is what is the point of this code - what operation is it performing.
2 comments

    scala> List(1,2,3).flatMap(n => List(n, n*2))         
    res7: List[Int] = List(1, 2, 2, 4, 3, 6)
That small snippet is the declaration of flatMap, i.e., it doesn't do anything if by do you mean compute.