• + 0 comments

    In Scala, assuming we're not able to use filter, we could instead use the fact that flatMap will filter out values of None.

    arr.flatMap(a => if (a < delim) Some(a) else None)