aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/strap/REF.lsp
blob: 30394145f777fa00224bea8b489eba56a055bad7 (plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
(/VERSIONCHECK 2) 

(DECLAIM (FTYPE (FUNCTION (|%Pair| |%Pair| |%Shell|) |%Boolean|)
                |REF;=;2$B;1|)) 

(PUT '|REF;=;2$B;1| '|SPADreplace| 'EQ) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Shell|) |%Pair|) |REF;ref;S$;2|)) 

(PUT '|REF;ref;S$;2| '|SPADreplace| 'LIST) 

(DECLAIM (FTYPE (FUNCTION (|%Pair| |%Shell|) |%Thing|) |REF;elt;$S;3|)) 

(PUT '|REF;elt;$S;3| '|SPADreplace| 'QCAR) 

(DECLAIM (FTYPE (FUNCTION (|%Pair| |%Thing| |%Shell|) |%Thing|)
                |REF;setelt;$2S;4|)) 

(DECLAIM (FTYPE (FUNCTION (|%Pair| |%Shell|) |%Thing|)
                |REF;deref;$S;5|)) 

(PUT '|REF;deref;$S;5| '|SPADreplace| 'QCAR) 

(DECLAIM (FTYPE (FUNCTION (|%Pair| |%Thing| |%Shell|) |%Thing|)
                |REF;setref;$2S;6|)) 

(DECLAIM (FTYPE (FUNCTION (|%Pair| |%Shell|) |%Thing|)
                |REF;coerce;$Of;7|)) 

(DEFUN |REF;=;2$B;1| (|p| |q| $) (DECLARE (IGNORE $)) (EQ |p| |q|)) 

(DEFUN |REF;ref;S$;2| (|v| $) (DECLARE (IGNORE $)) (LIST |v|)) 

(DEFUN |REF;elt;$S;3| (|p| $) (DECLARE (IGNORE $)) (QCAR |p|)) 

(DEFUN |REF;setelt;$2S;4| (|p| |v| $)
  (PROGN (RPLACA |p| |v|) (QCAR |p|))) 

(DEFUN |REF;deref;$S;5| (|p| $) (DECLARE (IGNORE $)) (QCAR |p|)) 

(DEFUN |REF;setref;$2S;6| (|p| |v| $)
  (PROGN (RPLACA |p| |v|) (QCAR |p|))) 

(DEFUN |REF;coerce;$Of;7| (|p| $)
  (SPADCALL (SPADCALL "ref" (|getShellEntry| $ 17))
      (LIST (SPADCALL (QCAR |p|) (|getShellEntry| $ 18)))
      (|getShellEntry| $ 20))) 

(DEFUN |Reference| (#0=#:G1406)
  (PROG ()
    (RETURN
      (PROG (#1=#:G1407)
        (RETURN
          (COND
            ((LETT #1#
                   (|lassocShiftWithFunction| (LIST (|devaluate| #0#))
                       (HGET |$ConstructorCache| '|Reference|)
                       '|domainEqualList|)
                   |Reference|)
             (|CDRwithIncrement| #1#))
            ('T
             (UNWIND-PROTECT
               (PROG1 (|Reference;| #0#) (LETT #1# T |Reference|))
               (COND
                 ((NOT #1#) (HREM |$ConstructorCache| '|Reference|))))))))))) 

(DEFUN |Reference;| (|#1|)
  (PROG (|dv$1| |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT |dv$1| (|devaluate| |#1|) . #0=(|Reference|))
        (LETT |dv$| (LIST '|Reference| |dv$1|) . #0#)
        (LETT $ (|newShell| 23) . #0#)
        (|setShellEntry| $ 0 |dv$|)
        (|setShellEntry| $ 3
            (LETT |pv$|
                  (|buildPredVector| 0 0
                      (LIST (|HasCategory| |#1| '(|SetCategory|)))) . #0#))
        (|haddProp| |$ConstructorCache| '|Reference| (LIST |dv$1|)
            (CONS 1 $))
        (|stuffDomainSlots| $)
        (|setShellEntry| $ 6 |#1|)
        (|setShellEntry| $ 7 (|Record| (|:| |value| |#1|)))
        (COND
          ((|testBitVector| |pv$| 1)
           (|setShellEntry| $ 21
               (CONS (|dispatchFunction| |REF;coerce;$Of;7|) $))))
        $)))) 

(MAKEPROP '|Reference| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) '|Rep| (|Boolean|)
             |REF;=;2$B;1| |REF;ref;S$;2| |REF;elt;$S;3|
             |REF;setelt;$2S;4| |REF;deref;$S;5| |REF;setref;$2S;6|
             (|String|) (|OutputForm|) (0 . |message|) (5 . |coerce|)
             (|List| $) (10 . |prefix|) (16 . |coerce|)
             (|SingleInteger|))
          '#(~= 21 |setref| 27 |setelt| 33 |ref| 39 |latex| 44 |hash|
             49 |elt| 54 |deref| 59 |coerce| 64 = 69)
          'NIL
          (CONS (|makeByteWordVec2| 1 '(1 0 1 1))
                (CONS '#(|SetCategory&| NIL |BasicType&| NIL)
                      (CONS '#((|SetCategory|) (|Type|) (|BasicType|)
                               (|CoercibleTo| 16))
                            (|makeByteWordVec2| 22
                                '(1 16 0 15 17 1 6 16 0 18 2 16 0 0 19
                                  20 1 0 16 0 21 2 1 8 0 0 1 2 0 6 0 6
                                  14 2 0 6 0 6 12 1 0 0 6 10 1 1 15 0 1
                                  1 1 22 0 1 1 0 6 0 11 1 0 6 0 13 1 1
                                  16 0 21 2 0 8 0 0 9)))))
          '|lookupComplete|)) 

(SETQ |$CategoryFrame|
      (|put| '|Reference| '|isFunctor|
             '(((~= ((|Boolean|) $ $)) (|has| |#1| (|SetCategory|))
                (ELT $ NIL))
               ((|coerce| ((|OutputForm|) $))
                (|has| |#1| (|SetCategory|)) (ELT $ 21))
               ((|hash| ((|SingleInteger|) $))
                (|has| |#1| (|SetCategory|)) (ELT $ NIL))
               ((|latex| ((|String|) $)) (|has| |#1| (|SetCategory|))
                (ELT $ NIL))
               ((= ((|Boolean|) $ $)) T (ELT $ 9))
               ((|setref| (|#1| $ |#1|)) T (ELT $ 14))
               ((|deref| (|#1| $)) T (ELT $ 13))
               ((|setelt| (|#1| $ |#1|)) T (ELT $ 12))
               ((|elt| (|#1| $)) T (ELT $ 11))
               ((|ref| ($ |#1|)) T (ELT $ 10)))
             (|addModemap| '|Reference| '(|Reference| |#1|)
                 '((|Join| (|Type|)
                           (CATEGORY |domain|
                               (SIGNATURE |ref| ($ |#1|))
                               (SIGNATURE |elt| (|#1| $))
                               (SIGNATURE |setelt| (|#1| $ |#1|))
                               (SIGNATURE |deref| (|#1| $))
                               (SIGNATURE |setref| (|#1| $ |#1|))
                               (SIGNATURE = ((|Boolean|) $ $))
                               (IF (|has| |#1| (|SetCategory|))
                                   (ATTRIBUTE (|SetCategory|))
                                   |%noBranch|)))
                   (|Type|))
                 T '|Reference|
                 (|put| '|Reference| '|mode|
                        '(|Mapping|
                             (|Join| (|Type|)
                                     (CATEGORY |domain|
                                      (SIGNATURE |ref| ($ |#1|))
                                      (SIGNATURE |elt| (|#1| $))
                                      (SIGNATURE |setelt|
                                       (|#1| $ |#1|))
                                      (SIGNATURE |deref| (|#1| $))
                                      (SIGNATURE |setref|
                                       (|#1| $ |#1|))
                                      (SIGNATURE = ((|Boolean|) $ $))
                                      (IF (|has| |#1| (|SetCategory|))
                                       (ATTRIBUTE (|SetCategory|))
                                       |%noBranch|)))
                             (|Type|))
                        |$CategoryFrame|))))