scala-extensions / scalax

Non-controversial, non-opinionated extensions for the scala standard library maintaining the same style
2 stars 0 forks source link

foldLeftWhile #3

Open cvogt opened 8 years ago

cvogt commented 8 years ago

https://github.com/cvogt/scala-extensions/blob/master/src/main/scala/collection.scala

jozic commented 8 years ago

+1 for this one question to discuss is how while should be expressed Chris has predicate on accumulator and next element, my implementation takes predicate on accumulator only https://github.com/jozic/scalax-collection/blob/master/src/main/scala/com/daodecode/scalax/collection/extensions/package.scala#L81

search on github reveals people do similar things: predicate on accumulator

something in between, predicate on acc and element, returning boolean

another way to look at it https://github.com/mvv/scala-extras/blob/master/src/main/scala/scalax/Data.scala#L226