Skip to content
Snippets Groups Projects
Commit d85c97c1 authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

groupWhile is no longer used

parent 0f5b3a4d
No related branches found
No related tags found
No related merge requests found
...@@ -153,29 +153,6 @@ class TemplateGenerator[T](val encoder: TemplateEncoder[T]) { ...@@ -153,29 +153,6 @@ class TemplateGenerator[T](val encoder: TemplateEncoder[T]) {
var lambdas = Map[T, LambdaTemplate[T]]() var lambdas = Map[T, LambdaTemplate[T]]()
@inline def registerLambda(idT: T, lambda: LambdaTemplate[T]) : Unit = lambdas += idT -> lambda @inline def registerLambda(idT: T, lambda: LambdaTemplate[T]) : Unit = lambdas += idT -> lambda
// Group elements that satisfy p toghether
// List(a, a, a, b, c, a, a), with p = _ == a will produce:
// List(List(a,a,a), List(b), List(c), List(a, a))
def groupWhile(p: T => Boolean, l: Seq[T]): Seq[Seq[T]] = {
var res: Seq[Seq[T]] = Nil
var c = l
while(c.nonEmpty) {
val (span, rest) = c.span(p)
if (span.isEmpty) {
res = res :+ Seq(rest.head)
c = rest.tail
} else {
res = res :+ span
c = rest
}
}
res
}
def requireDecomposition(e: Expr) = { def requireDecomposition(e: Expr) = {
exists{ exists{
case (_: FunctionInvocation) | (_: Assert) | (_: Ensuring) | (_: Choose) | (_: Application) => true case (_: FunctionInvocation) | (_: Assert) | (_: Ensuring) | (_: Choose) | (_: Application) => true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment