aboutsummaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authorShinya Sato <shinnya.sato@gmail.com>2024-03-05 18:19:27 +0900
committerShinya Sato <shinnya.sato@gmail.com>2024-03-05 18:19:27 +0900
commit49960d8950d001a372a0abde670a66ee60026957 (patch)
treeadad1d5fe428bf0bea151f71ed114223fc246bca /sample
parent0cf73da9ad035089c66d21021a656e4606796c47 (diff)
downloadinpla-49960d8950d001a372a0abde670a66ee60026957.tar.gz
inpla-49960d8950d001a372a0abde670a66ee60026957.zip
v0.12.0
Diffstat (limited to 'sample')
-rw-r--r--sample/lambda/245II.in (renamed from sample/245II.in)0
-rw-r--r--sample/lambda/245II_abbr.in (renamed from sample/245II_abbr.in)0
-rw-r--r--sample/lambda/245II_new.in (renamed from sample/245II_new.in)0
-rw-r--r--sample/lambda/linear-systemT.in (renamed from sample/linear-systemT.in)0
-rw-r--r--sample/process_networks/processnet1.in (renamed from sample/processnet1.in)0
-rw-r--r--sample/process_networks/processnet_fib.in (renamed from sample/processnet_fib.in)0
-rw-r--r--sample/pseudo_higher_order/map.in (renamed from sample/map.in)0
-rw-r--r--sample/pseudo_higher_order/reduce.in (renamed from sample/reduce.in)0
-rw-r--r--sample/puzzle/hanoi.in (renamed from sample/hanoi.in)0
-rw-r--r--sample/puzzle/nqueen.in (renamed from sample/nqueen.in)0
-rw-r--r--sample/recursive_functions/ack_3_5.in (renamed from sample/ack_3_5.in)0
-rw-r--r--sample/recursive_functions/fib-tail_9.in (renamed from sample/fib-tail_9.in)0
-rw-r--r--sample/recursive_functions/fib_9.in (renamed from sample/fib_9.in)0
-rw-r--r--sample/recursive_functions/fib_9_abbr.in (renamed from sample/fib_9_abbr.in)0
-rw-r--r--sample/recursive_functions/gcd.in (renamed from sample/gcd.in)0
-rw-r--r--sample/recursive_functions/gcd_another.in (renamed from sample/gcd_another.in)0
-rw-r--r--sample/recursive_functions/pow.in (renamed from sample/pow.in)0
-rw-r--r--sample/sort/bsort.in (renamed from sample/bsort.in)0
-rw-r--r--sample/sort/isort.in (renamed from sample/isort.in)0
-rw-r--r--sample/sort/msort.in (renamed from sample/msort.in)0
-rw-r--r--sample/sort/qsort.in (renamed from sample/qsort.in)0
-rw-r--r--sample/turing_machine/TuringMachine.in (renamed from sample/TuringMachine.in)8
-rw-r--r--sample/unary_numbers/AckSZ-3_5.in (renamed from sample/AckSZ-3_5.in)0
-rw-r--r--sample/unary_numbers/FibSZ_9.in (renamed from sample/FibSZ_9.in)0
-rw-r--r--sample/unary_numbers/hanoiSZ.in31
-rw-r--r--sample/unary_numbers/nqueenSZ.in (renamed from sample/nqueenSZ.in)8
26 files changed, 39 insertions, 8 deletions
diff --git a/sample/245II.in b/sample/lambda/245II.in
index 27910eb..27910eb 100644
--- a/sample/245II.in
+++ b/sample/lambda/245II.in
diff --git a/sample/245II_abbr.in b/sample/lambda/245II_abbr.in
index c2084ec..c2084ec 100644
--- a/sample/245II_abbr.in
+++ b/sample/lambda/245II_abbr.in
diff --git a/sample/245II_new.in b/sample/lambda/245II_new.in
index 2050179..2050179 100644
--- a/sample/245II_new.in
+++ b/sample/lambda/245II_new.in
diff --git a/sample/linear-systemT.in b/sample/lambda/linear-systemT.in
index f0e3ccb..f0e3ccb 100644
--- a/sample/linear-systemT.in
+++ b/sample/lambda/linear-systemT.in
diff --git a/sample/processnet1.in b/sample/process_networks/processnet1.in
index c648650..c648650 100644
--- a/sample/processnet1.in
+++ b/sample/process_networks/processnet1.in
diff --git a/sample/processnet_fib.in b/sample/process_networks/processnet_fib.in
index ab19eec..ab19eec 100644
--- a/sample/processnet_fib.in
+++ b/sample/process_networks/processnet_fib.in
diff --git a/sample/map.in b/sample/pseudo_higher_order/map.in
index c96daae..c96daae 100644
--- a/sample/map.in
+++ b/sample/pseudo_higher_order/map.in
diff --git a/sample/reduce.in b/sample/pseudo_higher_order/reduce.in
index 90ba145..90ba145 100644
--- a/sample/reduce.in
+++ b/sample/pseudo_higher_order/reduce.in
diff --git a/sample/hanoi.in b/sample/puzzle/hanoi.in
index 5be47c6..5be47c6 100644
--- a/sample/hanoi.in
+++ b/sample/puzzle/hanoi.in
diff --git a/sample/nqueen.in b/sample/puzzle/nqueen.in
index dd50ad1..dd50ad1 100644
--- a/sample/nqueen.in
+++ b/sample/puzzle/nqueen.in
diff --git a/sample/ack_3_5.in b/sample/recursive_functions/ack_3_5.in
index 19f92fa..19f92fa 100644
--- a/sample/ack_3_5.in
+++ b/sample/recursive_functions/ack_3_5.in
diff --git a/sample/fib-tail_9.in b/sample/recursive_functions/fib-tail_9.in
index 58f4cc5..58f4cc5 100644
--- a/sample/fib-tail_9.in
+++ b/sample/recursive_functions/fib-tail_9.in
diff --git a/sample/fib_9.in b/sample/recursive_functions/fib_9.in
index 7c4af1f..7c4af1f 100644
--- a/sample/fib_9.in
+++ b/sample/recursive_functions/fib_9.in
diff --git a/sample/fib_9_abbr.in b/sample/recursive_functions/fib_9_abbr.in
index 57a8c62..57a8c62 100644
--- a/sample/fib_9_abbr.in
+++ b/sample/recursive_functions/fib_9_abbr.in
diff --git a/sample/gcd.in b/sample/recursive_functions/gcd.in
index 5a57d8d..5a57d8d 100644
--- a/sample/gcd.in
+++ b/sample/recursive_functions/gcd.in
diff --git a/sample/gcd_another.in b/sample/recursive_functions/gcd_another.in
index e616e28..e616e28 100644
--- a/sample/gcd_another.in
+++ b/sample/recursive_functions/gcd_another.in
diff --git a/sample/pow.in b/sample/recursive_functions/pow.in
index a123b9f..a123b9f 100644
--- a/sample/pow.in
+++ b/sample/recursive_functions/pow.in
diff --git a/sample/bsort.in b/sample/sort/bsort.in
index 7b2e2d6..7b2e2d6 100644
--- a/sample/bsort.in
+++ b/sample/sort/bsort.in
diff --git a/sample/isort.in b/sample/sort/isort.in
index e637055..e637055 100644
--- a/sample/isort.in
+++ b/sample/sort/isort.in
diff --git a/sample/msort.in b/sample/sort/msort.in
index 599990b..599990b 100644
--- a/sample/msort.in
+++ b/sample/sort/msort.in
diff --git a/sample/qsort.in b/sample/sort/qsort.in
index 523d7d8..523d7d8 100644
--- a/sample/qsort.in
+++ b/sample/sort/qsort.in
diff --git a/sample/TuringMachine.in b/sample/turing_machine/TuringMachine.in
index 2819d19..260f609 100644
--- a/sample/TuringMachine.in
+++ b/sample/turing_machine/TuringMachine.in
@@ -40,8 +40,8 @@ getRule(r) >< (int state, int sym)
// resultTape << changeSym(headPos, sym, tape)
// -----------------------------------------
-changeSym(resultTape, headPos, sym) >< t:ts => // <-- t:ts is tape
- resultTape << changeSym_sub([], headPos, sym, t:ts);
+changeSym(resultTape, headPos, sym) >< tape => // <-- tape is a list
+ resultTape << changeSym_sub([], headPos, sym, tape);
changeSym_sub(r, done, int headPos, int sym) >< (int t):ts
| headPos == 0 => r << Append(done, sym:ts)
@@ -76,8 +76,8 @@ do(r, tape, int state, int head) >< Halt =>
// tapeDone << getSym(sym, int headPos, tape)
// -----------------------------------------
-getSym(tapeDone, sym, int headPos) >< t:ts => // <- t:ts is tape
- tapeDone << getSym_sub([], sym, headPos, t:ts);
+getSym(tapeDone, sym, int headPos) >< tape => // <- tape is a list
+ tapeDone << getSym_sub([], sym, headPos, tape);
getSym_sub(r, done, sym, int headPos) >< (int t):ts
diff --git a/sample/AckSZ-3_5.in b/sample/unary_numbers/AckSZ-3_5.in
index 4f41966..4f41966 100644
--- a/sample/AckSZ-3_5.in
+++ b/sample/unary_numbers/AckSZ-3_5.in
diff --git a/sample/FibSZ_9.in b/sample/unary_numbers/FibSZ_9.in
index b5a65a8..b5a65a8 100644
--- a/sample/FibSZ_9.in
+++ b/sample/unary_numbers/FibSZ_9.in
diff --git a/sample/unary_numbers/hanoiSZ.in b/sample/unary_numbers/hanoiSZ.in
new file mode 100644
index 0000000..a533d2d
--- /dev/null
+++ b/sample/unary_numbers/hanoiSZ.in
@@ -0,0 +1,31 @@
+// Tower of Hanoi Puzzle
+
+// Rules
+hanoi(return, source, target, aux) >< Z =>
+ // Erase the source, target and aux
+ source ~ Eraser,
+ target ~ Eraser,
+ aux ~ Eraser,
+
+ // result
+ return~[];
+
+hanoi(return, source, target, aux) >< S(n) =>
+ // Duplicate the source, target and aux
+ source ~ Dup(src1, Dup(src2, src3)),
+ target ~ Dup(tgt1, Dup(tgt2, tgt3)),
+ aux ~ Dup(aux1, aux2),
+
+
+ // recursive applications
+ n ~ Dup(nn1, Dup(nn2, nn3)),
+ hanoi(ret1, src1, aux1, tgt1)~nn1,
+ hanoi(ret2, aux2, tgt2, src2)~nn2,
+
+ // result
+ return << Append(ret1, (nn3,src3,tgt3):ret2);
+
+
+// Net
+hanoi(result, A, C, B) ~ S(S(S(Z)));
+result; \ No newline at end of file
diff --git a/sample/nqueenSZ.in b/sample/unary_numbers/nqueenSZ.in
index c61515c..b83b89c 100644
--- a/sample/nqueenSZ.in
+++ b/sample/unary_numbers/nqueenSZ.in
@@ -88,8 +88,8 @@ len_list_(len, done, ct) >< x:xs =>
len(ret) >< [] =>
ret~Z;
-len(ret) >< x:xs =>
- len_list(ret, Eraser)~x:xs;
+len(ret) >< list =>
+ len_list(ret, Eraser)~list;
@@ -162,8 +162,8 @@ queen(ret, n) >< () =>
queen_(r, b, n) >< Z =>
r~[], Eraser~b, Eraser~n;
-queen_(r, b, n) >< S(m) =>
- mem_ret, done_m, done_b << member(S(m), b),
+queen_(r, b, n) >< m =>
+ mem_ret, done_m, done_b << member(m, b),
queen__chk_m_in_b(r, done_b, n, done_m)~mem_ret;