A categorical programming language
修订版 | 62cedf9d54c7cdb27e2233e142f1a8bb686b7c6e (tree) |
---|---|
时间 | 2021-08-17 00:49:42 |
作者 | Corbin <cds@corb...> |
Commiter | Corbin |
Clean up and start thinking about publication.
@@ -14,17 +14,17 @@ Let: | ||
14 | 14 | Our combinators, given with categorical datatypes, are: |
15 | 15 | |
16 | 16 | id : X → X |
17 | -Given f : X → Y and g : Y → W, comp(f, g) : X → W | |
17 | +Given f : X → Y and g : Y → W, (comp f g) : X → W | |
18 | 18 | |
19 | 19 | ignore : X → 1 (*) |
20 | 20 | |
21 | 21 | fst : X × Y → X (*) |
22 | 22 | snd : X × Y → Y (*) |
23 | -Given f : X → Y and g : X → W, pair(f, g) : X → Y × W | |
23 | +Given f : X → Y and g : X → W, (pair f g) : X → Y × W | |
24 | 24 | |
25 | 25 | left : X → X + Y |
26 | 26 | right : Y → X + Y |
27 | -Given f : X → W and g : Y → W, case(f, g): X + Y → W | |
27 | +Given f : X → W and g : Y → W, (case f g): X + Y → W | |
28 | 28 | |
29 | 29 | assl : X × (Y × W) → (X × Y) × W |
30 | 30 | assr : (X × Y) × W → X × (Y × W) |
@@ -33,10 +33,10 @@ swap : X × Y → Y × X | ||
33 | 33 | |
34 | 34 | dup = pair(id, id) : X → X × X |
35 | 35 | |
36 | -Given f : X × Y → W, curry(f) : X → [Y, W] | |
37 | -Given f : X → [Y, W], uncurry(f) : X × Y → W | |
36 | +Given f : X × Y → W, (curry f) : X → [Y, W] | |
37 | +Given f : X → [Y, W], (uncurry f) : X × Y → W | |
38 | 38 | app = uncurry(id) : [X, Y] × X → Y |
39 | -Given f : X → Y, name(f) = curry(comp(snd, f)) : 1 → [X, Y] | |
39 | +Given f : X → Y, (name f) = (curry (comp snd f)) : 1 → [X, Y] | |
40 | 40 | |
41 | 41 | t : 1 → Ω |
42 | 42 | f : 1 → Ω |
@@ -46,12 +46,12 @@ disj : Ω × Ω → Ω | ||
46 | 46 | |
47 | 47 | zero : 1 → N |
48 | 48 | succ : N → N |
49 | -Given x : 1 → X and f : X → X, pr(x, f) : N → X | |
49 | +Given x : 1 → X and f : X → X, (pr x f) : N → X | |
50 | 50 | |
51 | 51 | nil : 1 → [X] |
52 | 52 | cons : X × [X] → [X] |
53 | -Given x : 1 → Y and f : X × Y → Y, fold(x, f) : [X] → Y | |
54 | -Given f : X → Y, map(f) = fold(nil, comp(pair(comp(fst, f), snd), cons)) : [X] → [Y] | |
53 | +Given x : 1 → Y and f : X × Y → Y, (fold x f) : [X] → Y | |
54 | +Given f : X → Y, (map f) = (fold nil (comp (pair (comp fst f) snd) cons)) : [X] → [Y] | |
55 | 55 | |
56 | 56 | Combinators with (*) are provided by OCaml by default; the others are in a |
57 | 57 | stub module. Type-checking is achieved by copying the combinators into |
@@ -14,5 +14,7 @@ in pkgs.stdenv.mkDerivation { | ||
14 | 14 | ocamlPackages.utop |
15 | 15 | # running compile.sh |
16 | 16 | ocaml |
17 | + # publishing | |
18 | + mktorrent | |
17 | 19 | ]; |
18 | 20 | } |
@@ -3,3 +3,5 @@ | ||
3 | 3 | * list/tail : [X] → [X] |
4 | 4 | * list/unfold : [Y, X × Y + 1] → [Y, [X]] |
5 | 5 | * rat |
6 | +* jelly: zero (pr ...), succ (pr ...), nil (fold ...), cons (fold ...) can all | |
7 | + be unrolled one step, allowing for loops to be inlined |