You are viewing a single comment's thread. Return to all comments →
Scala
def checkHeadLessThanDelim(delim: Int, head: Int, result: List[Int] ): List[Int] = { if (head < delim) { result :+ head } else { result } } def f(delim: Int, arr: List[Int], result: List[Int] = List(), headChecker: (Int, Int, List[Int]) => List[Int] = checkHeadLessThanDelim ): List[Int] = { if (arr.size > 0) { f(delim, arr.tail, headChecker(delim, arr.head, result)) } else { result } }
Seems like cookies are disabled on this browser, please enable them to open this website
Filter Array
You are viewing a single comment's thread. Return to all comments →
Scala