I'm looking for a Scala implementation of Haskell's groupBy.
The behavior should be like this:
isD :: Char -> Bool
isD c = elem c "123456789-_ "
groupBy (\a b -> isD a == isD b) "this is a line with 0123344334343434343434-343 3345"
["this"," ","is"," ","a"," ","line"," ","with"," 0123344334343434343434-343 3345"]
I tried the Scala groupBy function, however it only takes a function of one argument, instead of Haskell's 2. I also looked at partition, however it only returns a tuple.
The function I'm looking for should group each consecutive element matching a predicate.