fix order of returned lists in Util.separate

This commit is contained in:
Mark Harrah 2011-09-26 08:20:07 -04:00
parent a2e30494fe
commit 568fe3dc47
1 changed files with 4 additions and 1 deletions

View File

@ -6,7 +6,10 @@ package sbt
object Util
{
def separate[T,A,B](ps: Seq[T])(f: T => Either[A,B]): (Seq[A], Seq[B]) =
((Nil: Seq[A], Nil: Seq[B]) /: ps)( (xs, y) => prependEither(xs, f(y)) )
{
val (a,b) = ((Nil: Seq[A], Nil: Seq[B]) /: ps)( (xs, y) => prependEither(xs, f(y)) )
(a.reverse, b.reverse)
}
def prependEither[A,B](acc: (Seq[A], Seq[B]), next: Either[A,B]): (Seq[A], Seq[B]) =
next match