• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A categorical programming language


Commit MetaInfo

修订版c4d2e50723df88e4003105ab3e422a92a637778a (tree)
时间2021-09-16 13:35:45
作者Corbin <cds@corb...>
CommiterCorbin

Log Message

movelist: Use 1 and 2 for the unit and Boolean types.

更改概述

差异

--- a/movelist/movelist.scm
+++ b/movelist/movelist.scm
@@ -12,25 +12,25 @@
1212 ; constructors before trivial constructors.
1313 (conde
1414 ; Literal s and t.
15- ((== expr 'conj) (== s (list 'pair 'truth 'truth)) (== t 'truth))
16- ((== expr 'disj) (== s (list 'pair 'truth 'truth)) (== t 'truth))
15+ ((== expr 'conj) (== s (list 'pair '2 '2)) (== t '2))
16+ ((== expr 'disj) (== s (list 'pair '2 '2)) (== t '2))
1717 ((== expr 'f-add) (== s (list 'pair 'F 'F)) (== t 'F))
1818 ((== expr 'f-mul) (== s (list 'pair 'F 'F)) (== t 'F))
1919 ; Compound before trivial.
2020 ((== expr 'succ) (== s 'N) (== t 'N))
21- ((== expr 'zero) (== s 'unit) (== t 'N))
22- ((== expr 't) (== s 'unit) (== t 'truth))
23- ((== expr 'f) (== s 'unit) (== t 'truth))
24- ((== expr 'not) (== s 'truth) (== t 'truth))
25- ((== expr 'f-zero) (== s 'unit) (== t 'F))
26- ((== expr 'f-one) (== s 'unit) (== t 'F))
21+ ((== expr 'zero) (== s '1) (== t 'N))
22+ ((== expr 't) (== s '1) (== t '2))
23+ ((== expr 'f) (== s '1) (== t '2))
24+ ((== expr 'not) (== s '2) (== t '2))
25+ ((== expr 'f-zero) (== s '1) (== t 'F))
26+ ((== expr 'f-one) (== s '1) (== t 'F))
2727 ((== expr 'f-negate) (== s 'F) (== t 'F))
28- ((== expr 'f-sqrt) (== s 'F) (== t (list 'sum 'F 'unit)))
28+ ((== expr 'f-sqrt) (== s 'F) (== t (list 'sum 'F '1)))
2929 ; Literal s, recursive t.
3030 ((fresh (f x y) (== expr (list 'name f))
31- (== s 'unit) (== t (list 'hom x y)) (cammyo f x y)))
31+ (== s '1) (== t (list 'hom x y)) (cammyo f x y)))
3232 ((fresh (x f) (== expr (list 'pr x f))
33- (== s 'N) (cammyo x 'unit t) (cammyo f t t)))
33+ (== s 'N) (cammyo x '1 t) (cammyo f t t)))
3434 ; Parametric polymorphism with structural recursion on both sides.
3535 ((== expr 'swap) (fresh (x y) (== s (list 'pair x y)) (== t (list 'pair y x))))
3636 ((== expr 'assl)
@@ -39,18 +39,18 @@
3939 (fresh (x y z) (== s (list 'pair (list 'pair x y) z)) (== t (list 'pair x (list 'pair y z)))))
4040 ; Compound before trivial.
4141 ((== expr 'cons) (fresh (l) (== s (list 'pair l t)) (== t (list 'list l))))
42- ((== expr 'nil) (== s 'unit) (fresh (l) (== t (list 'list l))))
42+ ((== expr 'nil) (== s '1) (fresh (l) (== t (list 'list l))))
4343 ((fresh (f y z) (== expr (list 'curry f))
4444 (== t (list 'hom y z)) (cammyo f (list 'pair s y) z)))
4545 ((fresh (f x y) (== expr (list 'uncurry f))
4646 (== s (list 'pair x y)) (cammyo f x (list 'hom y t))))
4747 ((fresh (x f l) (== expr (list 'fold x f))
48- (== s (list 'list l)) (cammyo x 'unit t) (cammyo f (list 'pair l t) t)))
48+ (== s (list 'list l)) (cammyo x '1 t) (cammyo f (list 'pair l t) t)))
4949 ((fresh (f x y) (== expr (list 'map f))
5050 (== s (list 'list x)) (== t (list 'list y)) (cammyo f x y)))
5151 ; Literal t. But this is too easy of an answer, so we don't want it at the
5252 ; top of the list.
53- ((== expr 'ignore) (== t 'unit))
53+ ((== expr 'ignore) (== t '1))
5454 ; Parametric polymorphism on both sides, but one side recurses.
5555 ((== expr 'fst) (fresh (x) (== s (list 'pair t x))))
5656 ((== expr 'snd) (fresh (x) (== s (list 'pair x t))))