Skip to content
Snippets Groups Projects
Commit 9740e961 authored by Ali Sinan Köksal's avatar Ali Sinan Köksal
Browse files

parsing functions with underscores as constraints

parent 7ce76f84
No related branches found
No related tags found
No related merge requests found
...@@ -55,8 +55,8 @@ object PaperExamples extends App { ...@@ -55,8 +55,8 @@ object PaperExamples extends App {
c*y+d*u == 1).find c*y+d*u == 1).find
def boundedUnimodular(m : Int) = { def boundedUnimodular(m : Int) = {
boundedQ(m) && boundedQ(m) && (isUnimodular _)
((a : Int, b : Int, c : Int, d : Int) => isUnimodular(a,b,c,d)) // TODO would be great if we could write this as isUnimodular _ :) // ((a : Int, b : Int, c : Int, d : Int) => isUnimodular(a,b,c,d)) // TODO would be great if we could write this as isUnimodular _ :)
} }
def action : Unit = { def action : Unit = {
...@@ -211,7 +211,7 @@ object PaperExamples extends App { ...@@ -211,7 +211,7 @@ object PaperExamples extends App {
} }
def action : Unit = { def action : Unit = {
(1 to 7).foreach(i => { (1 to 3).foreach(i => {
val num = ((t : Tree) => validTree(t) && valuesWithin(t,i) && size(t) == i).findAll.size val num = ((t : Tree) => validTree(t) && valuesWithin(t,i) && size(t) == i).findAll.size
p("# of RBTs with " + i + " distinct els", num) p("# of RBTs with " + i + " distinct els", num)
}) })
......
...@@ -50,6 +50,11 @@ trait CallTransformation ...@@ -50,6 +50,11 @@ trait CallTransformation
val Function(funValDefs, funBody) = function val Function(funValDefs, funBody) = function
extracted += (function.pos -> extractFunction(unit, funValDefs, funBody)) extracted += (function.pos -> extractFunction(unit, funValDefs, funBody))
} }
case Apply(TypeApply(Select(Select(cpIdent, definitionsName), func2termName), typeTreeList), List(Block(Nil, function: Function))) if
(definitionsName.toString == "Definitions" && func2termName.toString.matches("func2term\\d")) => {
val Function(funValDefs, funBody) = function
extracted += (function.pos -> extractFunction(unit, funValDefs, funBody))
}
case Apply(Select(lhs, withFilterName), List(predicate: Function)) if withFilterName.toString == "withFilter" && hasLIteratorType(lhs) => { case Apply(Select(lhs, withFilterName), List(predicate: Function)) if withFilterName.toString == "withFilter" && hasLIteratorType(lhs) => {
val Function(funValDefs, funBody) = predicate val Function(funValDefs, funBody) = predicate
extracted += (predicate.pos -> extractWithFilterPredicate(unit, funValDefs, funBody)) extracted += (predicate.pos -> extractWithFilterPredicate(unit, funValDefs, funBody))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment