• 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

修订版a12a5d8c3511ccb1a85f4464b881de031023c5f0 (tree)
时间2022-04-09 10:29:59
作者Corbin <cds@corb...>
CommiterCorbin

Log Message

Use CPython 2.7 instead of PyPy.

This is a nixpkgs issue, but I genuinely don't know how it'll turn out,
and I can't afford to wait for them.

更改概述

差异

--- a/cammy-rpy/builder.nix
+++ b/cammy-rpy/builder.nix
@@ -4,7 +4,7 @@ let
44 inherit (nixpkgs.pkgs)
55 fetchFromGitLab stdenv
66 pkg-config libffi stb
7- pypy pypyPackages;
7+ python2 python2Packages;
88 # https://foss.heptapod.net/pypy/pypy/
99 pypySrc = fetchFromGitLab {
1010 domain = "foss.heptapod.net";
@@ -28,9 +28,9 @@ in
2828 buildInputs = [
2929 # always required
3030 pypySrc pkg-config stb
31- pypy pypyPackages.py
31+ python2 python2Packages.py
3232 # only required for JIT
33- pypyPackages.pytest libffi
33+ python2Packages.pytest libffi
3434 ];
3535
3636 # JELLY_PATH = "${jelly}/bin/jelly";
@@ -42,7 +42,7 @@ in
4242 cp -r ${pypySrc}/rpython .
4343 chmod -R u+w rpython/
4444 # Do the actual translation.
45- ${pypy}/bin/pypy -mrpython -O${opt} ${entrypoint}
45+ ${python2}/bin/python2 -mrpython -O${opt} ${entrypoint}
4646 '';
4747
4848 installPhase = ''
--- a/cammy-rpy/draw.py
+++ b/cammy-rpy/draw.py
@@ -1,3 +1,5 @@
1+# coding: utf-8
2+
13 import math, sys
24
35 from rpython.rlib.jit import JitDriver, unroll_safe #, set_param
--- a/hive/demo/burning-ship-color.cammy
+++ b/hive/demo/burning-ship-color.cammy
@@ -1,7 +1,7 @@
11 (comp
22 (comp
3- (fractal-membership-color v2/burning-ship nat/9)
4- (monads/maybe/guard (pair/of nat/lte id (fun/const nat/8))))
3+ (fractal-membership-color v2/burning-ship (comp nat/16 succ))
4+ (monads/maybe/guard (pair/of nat/lte id (fun/const nat/16))))
55 (case
66 (comp (comp nat/to-f f/radians-to-turns) h2rgb)
77 (v3/broadcast f-zero)))
--- /dev/null
+++ b/hive/list/flatten.cammy
@@ -0,0 +1,3 @@
1+(fold nil list/append)
2+
3+Flatten a list of lists into a single list.
--- /dev/null
+++ b/hive/list/pair.cammy
@@ -0,0 +1,11 @@
1+(uncurry
2+ (fold
3+ (fun/name (fun/const nil))
4+ (curry
5+ (comp
6+ (pair
7+ (pair (comp fst fst) snd)
8+ (fun/apppair (comp fst snd) snd))
9+ cons))))
10+
11+Zip a single value into a list.
--- /dev/null
+++ b/hive/monads/guard.cammy
@@ -0,0 +1,4 @@
1+(comp (pair @2 id) (uncurry (bool/if (fun/const @1) @0)))
2+
3+Given the unit and zero of some monad, and some filtering predicate, test a
4+value in that monad.
--- /dev/null
+++ b/hive/monads/list/add.cammy
@@ -0,0 +1,3 @@
1+list/append
2+
3+Addition in the list monad.
--- /dev/null
+++ b/hive/monads/list/int-bind.cammy
@@ -0,0 +1,3 @@
1+(comp (comp list/pair (list/map (comp pair/swap fun/app))) list/flatten)
2+
3+Internal bind in the list monad.
--- /dev/null
+++ b/hive/monads/list/join.cammy
@@ -0,0 +1,3 @@
1+list/flatten
2+
3+The join operation in the list monad.
--- /dev/null
+++ b/hive/monads/list/zero.cammy
@@ -0,0 +1,3 @@
1+nil
2+
3+The zero of the list monad.
--- a/shell.nix
+++ b/shell.nix
@@ -23,9 +23,9 @@ in pkgs.stdenv.mkDerivation {
2323 # using cammy-repl
2424 rlwrap
2525 # working with sexps
26- ocamlPackages.sexp
26+ # ocamlPackages.sexp
2727 # benchmarking
28- busybox feedgnuplot
28+ busybox feedgnuplot linuxPackages.perf
2929 # publishing
3030 keychain mktorrent pngcrush
3131 # experimenting with GLSL
--- a/todo.txt
+++ b/todo.txt
@@ -63,3 +63,31 @@
6363 * CI: automatic generation of demo images
6464 * Would be nice to know how long it takes, too
6565 * Parameterize by number of iterations?
66+* Native code generation with QBE
67+ * Strategy: Emit one procedure for each expression under a (curry) or
68+ (uncurry), defunctionalizing
69+ * Should arity be implied, so that these procedures can take their pairs
70+ as two arguments?
71+ * Execution proceeds like the CAM
72+ * Like ZINC?
73+ * There's an accumulator, an environment stack, and a code pointer
74+ * Uniform values: every value fits into the same 64-bit cell
75+ * Opaque: Polymorphic values are passed as-is, cannot be inspected
76+ * Unit: doesn't matter!
77+ * Bools: nonzero and zero
78+ * Nats: tagged union of smallnat and bignat
79+ * smallnat: up to 2**63-1
80+ * bignat: pointer to heap-allocated size-prefixed array
81+ * Floats: IEEE 754 double-precision, native endianness
82+ * Lists: pointer to heap-allocated size-prefixed array of pointers
83+ * Maybe lists of bits would be stored as nats
84+ * Pairs: pointer to heap-allocated array of two cells
85+ * Sums: pointer to heap-allocated array of two cells
86+ * The first cell is a Boolean
87+ * Maybe sums of unit, bools, nats, lists, pairs can be encoded with
88+ tagged pointers
89+ * Homs: pointer to heap-allocated array of two cells
90+ * The first cell is a code pointer
91+ * The second cell is the curried data
92+* fun/precomp is an ingredient of CPS transformation
93+ * https://okmij.org/ftp/continuations/undelimited.html