A categorical programming language
修订版 | bd63be8d401d19b9d4904795a52903c8ddf3f86d (tree) |
---|---|
时间 | 2021-11-15 13:47:25 |
作者 | Corbin <cds@corb...> |
Commiter | Corbin |
hive: Basic 2D signed distance functions.
Circles and metaballs.
@@ -0,0 +1,9 @@ | ||
1 | +(comp | |
2 | + (sdf2/metaballs (comp f/4 f-recip) | |
3 | + (fun/const | |
4 | + (comp | |
5 | + (pair (pair (comp (comp f/4 f-recip) fun/dup) (comp f/3 f-recip)) | |
6 | + (comp | |
7 | + (pair (pair (pair (comp f-one f-negate) f-zero) (comp f/2 f-recip)) | |
8 | + nil) cons)) cons))) | |
9 | + sdf2d) |
@@ -0,0 +1 @@ | ||
1 | +(comp (pair fst (comp snd f-recip)) f-mul) |
@@ -0,0 +1 @@ | ||
1 | +(comp (pair f-lt id) bool/pick) |
@@ -0,0 +1 @@ | ||
1 | +(comp (pair @0 @1) f/min) |
@@ -0,0 +1 @@ | ||
1 | +(f/subpair v2/norm (fun/const f-one)) |
@@ -0,0 +1 @@ | ||
1 | +(f/subpair @1 (fun/const @0)) |
@@ -0,0 +1,13 @@ | ||
1 | +(f/subpair | |
2 | + (fun/apppair | |
3 | + (comp @1 (fold | |
4 | + (fun/name (fun/const f-zero)) | |
5 | + (curry | |
6 | + (f/addpair | |
7 | + (f/divpair (comp (comp fst fst) snd) | |
8 | + (comp (comp | |
9 | + (pair (comp (comp fst fst) fst) snd) | |
10 | + (v2/map2 f/sub)) v2/norm)) | |
11 | + (fun/apppair (comp fst snd) snd))))) | |
12 | + id) | |
13 | + (fun/const @0)) |
@@ -0,0 +1,5 @@ | ||
1 | +(f/mulpair | |
2 | + (comp | |
3 | + (comp (pair id (fun/const (pair @0 @0))) (v2/map2 f/div)) | |
4 | + @1) | |
5 | + (fun/const @0)) |
@@ -0,0 +1,3 @@ | ||
1 | +(comp | |
2 | + (comp (pair id (fun/const @0)) (v2/map2 f/sub)) | |
3 | + @1) |
@@ -0,0 +1 @@ | ||
1 | +(f/minpair @0 @1) |
@@ -0,0 +1,5 @@ | ||
1 | +(v3/triple id | |
2 | + (comp | |
3 | + (comp (pair id (fun/const f-zero)) f-lt) | |
4 | + (comp either (case f-zero f-one))) | |
5 | + id) |
@@ -20,3 +20,6 @@ | ||
20 | 20 | * Remove movelist djinn, maybe? |
21 | 21 | * At least give up on having the clauses magically sorted; sort them in the |
22 | 22 | same order as the docs and cammy-run |
23 | +* f/ltpair | |
24 | +* Double-negation monad for CPS? | |
25 | +* fun/name should always start from 1 |