fix: update benchmark paths to tests directory
This commit is contained in:
@@ -51,11 +51,11 @@ func runSample(samplePath string) error {
|
|||||||
// Benchmark all samples using sub-benchmarks.
|
// Benchmark all samples using sub-benchmarks.
|
||||||
func BenchmarkSamples(b *testing.B) {
|
func BenchmarkSamples(b *testing.B) {
|
||||||
samples := map[string]string{
|
samples := map[string]string{
|
||||||
"Church": "../../samples/church.test",
|
"Church": "../../tests/church.test",
|
||||||
"Fast": "../../samples/fast.test",
|
"Fast": "../../tests/fast.test",
|
||||||
"Saccharine": "../../samples/saccharine.test",
|
"Saccharine": "../../tests/saccharine.test",
|
||||||
"Simple": "../../samples/simple.test",
|
"Simple": "../../tests/simple.test",
|
||||||
"Thunk": "../../samples/thunk.test",
|
"Thunk": "../../tests/thunk.test",
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, path := range samples {
|
for name, path := range samples {
|
||||||
|
|||||||
7
samples/church.txt
Normal file
7
samples/church.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
0 := \f.\x.x
|
||||||
|
inc n := \f x.(f (n f x))
|
||||||
|
exp n m := (m n)
|
||||||
|
|
||||||
|
N := (inc (inc (inc (inc (inc 0)))))
|
||||||
|
|
||||||
|
(exp N N)
|
||||||
11
samples/fast.txt
Normal file
11
samples/fast.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fix f := (\x.(f (x x)) \x.(f (x x)))
|
||||||
|
|
||||||
|
inc := (fix \self.\l.(((l \x.\y.x) ((((l \x.\y.y) \x.\y.x) \c.((c \x.\y.x) \c.((c \x.\y.y) (self ((l \x.\y.y) \x.\y.y))))) \c.((c \x.\y.x) \c.((c \x.\y.x) ((l \x.\y.y) \x.\y.y))))) \c.((c \x.\y.x) \c.((c \x.\y.x) \VAR0.\x.\y.y))))
|
||||||
|
one := \c.((c \x.\y.x) \c.((c \x.\y.x) \VAR0.\x.\y.y))
|
||||||
|
double := \N.\c.((c \x.\y.x) \c.((c \x.\y.y) N))
|
||||||
|
print := (fix \self.\l.(((l \x.\y.x) (((((l \x.\y.y) \x.\y.x) 1) 0) (self ((l \x.\y.y) \x.\y.y)))) END))
|
||||||
|
|
||||||
|
|
||||||
|
N := \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.y) \c.((c \x.\y.x) \c.((c \x.\y.x) \VAR0.\x.\y.y))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||||
|
|
||||||
|
(print N)
|
||||||
52
samples/saccharine.txt
Normal file
52
samples/saccharine.txt
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
T x y := x
|
||||||
|
F x y := y
|
||||||
|
if b t e := (b t e)
|
||||||
|
|
||||||
|
pair a b := \c.(c a b)
|
||||||
|
left p := (p T)
|
||||||
|
right p := (p F)
|
||||||
|
|
||||||
|
print n := (n 0 1 end)
|
||||||
|
|
||||||
|
fix f := (\x.(f (x x)) \x.(f (x x)))
|
||||||
|
|
||||||
|
some x := (pair T x)
|
||||||
|
none := \.F
|
||||||
|
isfull := left
|
||||||
|
unwrap := right
|
||||||
|
|
||||||
|
nil := none
|
||||||
|
push i l := (some (pair i l))
|
||||||
|
peek l := (left (unwrap l))
|
||||||
|
pop l := (right (unwrap l))
|
||||||
|
|
||||||
|
inc := (fix \self l.{
|
||||||
|
(if (isfull l)
|
||||||
|
(if (peek l)
|
||||||
|
(push F (self (pop l)))
|
||||||
|
(push T (pop l))
|
||||||
|
)
|
||||||
|
(push T nil)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
print := (fix \self l.{
|
||||||
|
(if (isfull l)
|
||||||
|
((if (peek l) 1 0) (self (pop l)))
|
||||||
|
END
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
one := (push T nil)
|
||||||
|
double N := (push F N)
|
||||||
|
|
||||||
|
N :=
|
||||||
|
(double (double (double (double (double
|
||||||
|
(double (double (double (double (double
|
||||||
|
(double (double (double (double (double
|
||||||
|
(double (double (double (double (double
|
||||||
|
(double (double (double (double (double
|
||||||
|
(double (double (double (double (double
|
||||||
|
one))))))))))))))))))))))))))))))
|
||||||
|
|
||||||
|
(print N)
|
||||||
16
samples/simple.txt
Normal file
16
samples/simple.txt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
(\0.
|
||||||
|
(\inc.
|
||||||
|
(\add.
|
||||||
|
(\mult.
|
||||||
|
(\exp.
|
||||||
|
(exp (inc (inc (inc (inc 0)))) (inc (inc (inc (inc (inc 0))))))
|
||||||
|
\n m.(m n)
|
||||||
|
)
|
||||||
|
\m n f.(m (n f))
|
||||||
|
)
|
||||||
|
\n m.(m inc n)
|
||||||
|
)
|
||||||
|
\n f x.(f (n f x))
|
||||||
|
)
|
||||||
|
\f x.x
|
||||||
|
)
|
||||||
1
samples/thunk.txt
Normal file
1
samples/thunk.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
(\.VALUE anything)
|
||||||
Reference in New Issue
Block a user