Skip to content

Commit 005145f

Browse files
committed
Too much fun. Added M8 with Power and Copy operation. For now, interpreter can only work if final evolution step has an operation. This can be cleaned up by incorporating type names when no op is defined.
1 parent 0e2994a commit 005145f

30 files changed

Lines changed: 293 additions & 46 deletions

File tree

domain/math/src/main/scala/org/combinators/ep/domain/math/M5.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ trait M5 extends Evolution {
4242
new BinaryInst(Add, LitInst(0.0), LitInst(7.0)))
4343

4444

45-
new Leaf(2.0)
46-
4745
val treeSimplified = new Node(Seq(new Leaf(2.0), new Leaf(7.0)), Mult.name.hashCode)
4846
/**
4947
* Special test case for same queries.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package org.combinators.ep.domain.math /*DD:LI:AI*/
2+
3+
import org.combinators.ep.domain.Evolution
4+
import org.combinators.ep.domain.tree.{Leaf, Node}
5+
6+
trait M8 extends Evolution {
7+
self: M0 with M1 with M2 with M3 with M4 with M5 with M6 with M7 =>
8+
val domain:MathDomain
9+
import domain._
10+
11+
// SquareRoot of inner value, and an operation Find that counts the number
12+
case object Power extends Binary("Power")
13+
case object Copy extends ProducerOperation("copy")
14+
15+
val m8 = Model("m8", Seq(Power), Seq(Copy), last = m7)
16+
17+
override def getModel = m8
18+
19+
val m8_1 = new BinaryInst(Power, LitInst(6.0), LitInst(2.0))
20+
val m8_2 = new BinaryInst(Power, LitInst(25.0), LitInst(-0.5))
21+
val m8_3 = new BinaryInst(Power, LitInst(10.0), LitInst(0.0))
22+
23+
val m8_tree = new BinaryInst(Mult, LitInst(2.0), new UnaryInst(Sqrt, LitInst(7.0)))
24+
val m8_tree1 = new Node(Seq(new Leaf(2.0), new Node(Seq(new Leaf(7.0)), Sqrt.name.hashCode)), Mult.name.hashCode)
25+
26+
def M8_tests:Seq[TestCase] = Seq(
27+
EqualsTestCase(m8_1, Eval, ExistsInstance(Double)(36.0)),
28+
EqualsTestCase(m8_2, PrettyP, ExistsInstance(String)("Power(25.0,-0.5)")),
29+
EqualsTestCase(m8_3, Eval, ExistsInstance(Double)(1.0)),
30+
31+
EqualsCompositeTestCase(m8_3, Seq((Simplify, Seq.empty), (PrettyP, Seq.empty)), ExistsInstance(String)("1.0")),
32+
EqualsCompositeTestCase(m8_tree, Seq((Copy, Seq.empty), (AsTree, Seq.empty)), ExistsInstance(TreeType)(m8_tree1)),
33+
34+
)
35+
}

language/cpp/src/main/scala/org/combinators/ep/language/cpp/deployment/oo/build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package org.combinators.ep.language.cpp.deployment.oo
2-
/* Generated: Thu Jun 13 12:39:16 EDT 2019 */
2+
/* Generated: Wed Jun 26 17:53:46 EDT 2019 */
33
import org.combinators.ep.domain.math._
44
import org.combinators.ep.domain._
55
import org.combinators.ep.language.cpp._

language/cpp/src/main/scala/org/combinators/ep/language/cpp/deployment/visitor/build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package org.combinators.ep.language.cpp.deployment.visitor
2-
/* Generated: Thu Jun 13 12:39:16 EDT 2019 */
2+
/* Generated: Wed Jun 26 17:53:47 EDT 2019 */
33
import org.combinators.ep.domain.math._
44
import org.combinators.ep.domain._
55
import org.combinators.ep.language.cpp._

language/cpp/src/main/scala/org/combinators/ep/language/cpp/deployment/visitorTable/build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package org.combinators.ep.language.cpp.deployment.visitorTable
2-
/* Generated: Thu Jun 13 12:39:16 EDT 2019 */
2+
/* Generated: Wed Jun 26 17:53:47 EDT 2019 */
33
import org.combinators.ep.domain.math._
44
import org.combinators.ep.domain._
55
import org.combinators.ep.language.cpp._

language/gj/src/main/scala/org/combinators/ep/language/gj/deployment/wadler/build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package org.combinators.ep.language.gj.deployment.wadler
2-
/* Generated: Thu Jun 13 12:39:16 EDT 2019 */
2+
/* Generated: Wed Jun 26 17:53:47 EDT 2019 */
33
import org.combinators.ep.domain.math._
44
import org.combinators.ep.domain._
55
import org.combinators.ep.language.gj._

language/haskell/src/main/scala/org/combinators/ep/language/haskell/deployment/alacarte/build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package org.combinators.ep.language.haskell.deployment.alacarte
2-
/* Generated: Thu Jun 13 12:39:16 EDT 2019 */
2+
/* Generated: Wed Jun 26 17:53:46 EDT 2019 */
33
import org.combinators.ep.domain.math._
44
import org.combinators.ep.domain._
55
import org.combinators.ep.language.haskell._

language/haskell/src/main/scala/org/combinators/ep/language/haskell/deployment/grow/build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package org.combinators.ep.language.haskell.deployment.grow
2-
/* Generated: Thu Jun 13 12:39:16 EDT 2019 */
2+
/* Generated: Wed Jun 26 17:53:46 EDT 2019 */
33
import org.combinators.ep.domain.math._
44
import org.combinators.ep.domain._
55
import org.combinators.ep.language.haskell._

language/haskell/src/main/scala/org/combinators/ep/language/haskell/deployment/straight/build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package org.combinators.ep.language.haskell.deployment.straight
2-
/* Generated: Thu Jun 13 12:39:16 EDT 2019 */
2+
/* Generated: Wed Jun 26 17:53:46 EDT 2019 */
33
import org.combinators.ep.domain.math._
44
import org.combinators.ep.domain._
55
import org.combinators.ep.language.haskell._

language/java/src/main/java/make/Create.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ static final String destinationPath(String lang) {
3535
new Evolution ("M5", "M4"),
3636
new Evolution ("M6", "M5"),
3737
new Evolution ("M7", "M6"),
38+
new Evolution ("M8", "M7"),
3839
};
3940

4041
/** Known Variations to generate. */

0 commit comments

Comments
 (0)