Skip to content
Snippets Groups Projects
Commit 7a2dfc71 authored by Manos Koukoutos's avatar Manos Koukoutos
Browse files

Improve this benchmark

parent 7cc4e4fc
No related branches found
No related tags found
No related merge requests found
...@@ -18,12 +18,10 @@ object RunLength { ...@@ -18,12 +18,10 @@ object RunLength {
} }
def legal[A](l: List[(BigInt, A)]): Boolean = l match { def legal[A](l: List[(BigInt, A)]): Boolean = l match {
case Cons((i, x), tl) => case Nil() => true
i > 0 && (tl match { case Cons((i, _), Nil()) => i > 0
case Cons((_, y), _) => x != y case Cons((i, x), tl@Cons((_, y), _)) =>
case _ => true i > 0 && x != y && legal(tl)
}) && legal(tl)
case _ => true
} }
def encode[A](l: List[A]): List[(BigInt, A)] = { def encode[A](l: List[A]): List[(BigInt, A)] = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment