• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-cqtcocoa誰得pythonphprubygameguibathyscaphec翻訳計画中(planning stage)omegatframeworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

A categorical programming language


Commit MetaInfo

修订版03bf7e79b7c5d4752fde089b7ce753e5a4efbc4d (tree)
时间2021-09-08 11:42:47
作者Corbin <cds@corb...>
CommiterCorbin

Log Message

Uncurry nat/add and nat/mul, fix compilation.

This is enough to get everything unbroken up to list/gauss.

更改概述

差异

--- a/compile.sh
+++ b/compile.sh
@@ -11,6 +11,7 @@ cat "$1"
1111 frame=$(nix-build frame/)
1212 jelly=$(nix-build jelly/Cargo.nix -A rootCrate.build)
1313 <"$1" $frame/bin/frame hive/ | $jelly/bin/jelly >"$tmpdir/program.cammy"
14+cat "$tmpdir/program.cammy"
1415
1516 fullname=$(basename -- $1)
1617 name="${fullname%.*}"
@@ -20,7 +21,7 @@ movelist=$(nix-build movelist/)
2021 ty=$($movelist/bin/movelist type-check <"$tmpdir/program.cammy")
2122
2223 # Compute the final piece.
23-cat "$tmpdir/program.cammy"
24+sed -i -e 's,case,cammy-case,g' -e 's,cons,cammy-cons,g' -e 's,map,cammy-map,g' "$tmpdir/program.cammy"
2425 cat stub.scm <(echo '(cammy-run') "$tmpdir/program.cammy" <(echo "'$ty)") >"$tmpdir/$name.scm"
2526 # Compile with Chicken.
2627 csc -O3 -o "$name" "$tmpdir/$name.scm"
--- a/hive/nat/double.cammy
+++ b/hive/nat/double.cammy
@@ -1 +1 @@
1-(comp dup (uncurry nat/add))
1+(comp dup nat/add)
--- a/hive/nat/exp.cammy
+++ b/hive/nat/exp.cammy
@@ -1 +1 @@
1-(pr (curry (comp (comp ignore zero) succ)) (curry (comp (pair app snd) (uncurry nat/mul))))
1+(pr (curry (comp (comp ignore zero) succ)) (curry (comp (pair app snd) nat/mul)))
--- a/hive/nat/fact.cammy
+++ b/hive/nat/fact.cammy
@@ -1,4 +1,4 @@
11 (comp (pr
22 (comp zero (pair id succ))
3- (comp (pair (comp fst succ) snd) (pair fst (uncurry nat/mul)))
3+ (comp (pair (comp fst succ) snd) (pair fst nat/mul))
44 ) snd)
--- a/hive/nat/mul.cammy
+++ b/hive/nat/mul.cammy
@@ -1 +1 @@
1-(pr (curry (comp ignore zero)) (curry (comp (pair app snd) (uncurry nat/add))))
1+(uncurry (pr (curry (comp ignore zero)) (curry (comp (pair app snd) nat/add))))
--- a/hive/nat/sqr.cammy
+++ b/hive/nat/sqr.cammy
@@ -1 +1 @@
1-(comp dup (uncurry nat/mul))
1+(comp dup nat/mul)
--- a/hive/nat/square.cammy
+++ /dev/null
@@ -1 +0,0 @@
1-(comp dup (uncurry nat/mul))
--- a/hive/nat/sum.cammy
+++ b/hive/nat/sum.cammy
@@ -1 +1 @@
1-(fold zero (uncurry nat/add))
1+(fold zero nat/add)