-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils.metta
69 lines (47 loc) · 1.49 KB
/
utils.metta
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
; (convert-to-metta-file utils $_170070 index/utils.pl index/utils.metta)
(= (listdiff $L () $L) True)
; /* utilities */
(= (listdiff $L (Cons $H $T) $V)
(remove $H $L $L1)
(listdiff $L1 $T $V))
(= (remove $_ () ()) True)
(= (remove $H (Cons $H $T) $L)
(remove $H $T $L))
(= (remove $X (Cons $H $T) (Cons $H $L))
(remove $X $T $L)
(\= $X $H))
(= (select-two (Cons $H $T) $H $Y)
(member $Y $T))
(= (select-two (Cons $H $T) $X $Y)
(select-two $T $X $Y))
(= (forall $Goal $Condition)
(bagof0 $Condition $Goal $List)
(forall1 $List))
(= (forall1 ()) True)
(= (forall1 (Cons $H $T))
(call $H)
(forall1 $T))
(= (bagof0 $T $G $L)
(bagof $T $G $L)
(set-det))
(= (bagof0 $T $G ()) True)
(= (setof0 $T $G $L)
(setof $T $G $L)
(set-det))
(= (setof0 $T $G ()) True)
; (error
; (syntax-error operator_expected)
; (file index/utils.pl 37 4 521))
(= (add-if $X $Ys $Ys)
(member $X $Ys)
(set-det))
(= (add-if $X $Ys ([|] $X $Ys)) True)
(= (flatten $Xs $Ys)
(flatten-dl $Xs Nil $Ys))
(= (flatten-dl Nil $Ys $Ys)
(set-det))
(= (flatten-dl (Cons $X $Xs) $Ys0 $Ys)
(set-det)
(flatten-dl $Xs $Ys0 $Ys1)
(flatten-dl $X $Ys1 $Ys))
(= (flatten-dl $X $Xs ([|] $X $Xs)) True)