
(/VERSIONCHECK 2) 

(DEFUN |UNISEG;segment;S$;1| (|a| $) (CONS 0 (CONS |a| 1))) 

(DEFUN |UNISEG;segment;2S$;2| (|a| |b| $) (CONS 1 (VECTOR |a| |b| 1))) 

(DEFUN |UNISEG;BY;$I$;3| (|s| |i| $)
  (COND
    ((QEQCAR |s| 1)
     (CONS 1
           (VECTOR (SPADCALL |s| (QREFELT $ 10))
                   (SPADCALL |s| (QREFELT $ 11)) |i|)))
    ('T (CONS 0 (CONS (SPADCALL |s| (QREFELT $ 10)) |i|))))) 

(DEFUN |UNISEG;lo;$S;4| (|s| $)
  (COND ((QEQCAR |s| 0) (QCAR (QCDR |s|))) ('T (QVELT (QCDR |s|) 0)))) 

(DEFUN |UNISEG;low;$S;5| (|s| $)
  (COND ((QEQCAR |s| 0) (QCAR (QCDR |s|))) ('T (QVELT (QCDR |s|) 0)))) 

(PUT '|UNISEG;hasHi;$B;6| '|SPADreplace| '(XLAM (|s|) (QEQCAR |s| 1))) 

(DEFUN |UNISEG;hasHi;$B;6| (|s| $) (QEQCAR |s| 1)) 

(DEFUN |UNISEG;hi;$S;7| (|s| $)
  (COND
    ((NULL (SPADCALL |s| (QREFELT $ 16)))
     (|error| "hi: segment has no upper bound"))
    ('T (QVELT (QCDR |s|) 1)))) 

(DEFUN |UNISEG;high;$S;8| (|s| $)
  (COND
    ((NULL (SPADCALL |s| (QREFELT $ 16)))
     (|error| "high: segment has no upper bound"))
    ('T (QVELT (QCDR |s|) 1)))) 

(DEFUN |UNISEG;incr;$I;9| (|s| $)
  (COND ((QEQCAR |s| 0) (QCDR (QCDR |s|))) ('T (QVELT (QCDR |s|) 2)))) 

(DEFUN |UNISEG;SEGMENT;S$;10| (|a| $) (SPADCALL |a| (QREFELT $ 8))) 

(DEFUN |UNISEG;SEGMENT;2S$;11| (|a| |b| $)
  (SPADCALL |a| |b| (QREFELT $ 9))) 

(DEFUN |UNISEG;coerce;S$;12| (|sg| $)
  (SPADCALL (SPADCALL |sg| (QREFELT $ 22))
      (SPADCALL |sg| (QREFELT $ 23)) (QREFELT $ 9))) 

(DEFUN |UNISEG;convert;S$;13| (|a| $) (CONS 1 (VECTOR |a| |a| 1))) 

(DEFUN |UNISEG;=;2$B;14| (|s1| |s2| $)
  (COND
    ((QEQCAR |s1| 0)
     (COND
       ((QEQCAR |s2| 0)
        (COND
          ((SPADCALL (QCAR (QCDR |s1|)) (QCAR (QCDR |s2|))
               (QREFELT $ 26))
           (EQL (QCDR (QCDR |s1|)) (QCDR (QCDR |s2|))))
          ('T 'NIL)))
       (#0='T 'NIL)))
    ((QEQCAR |s1| 1)
     (COND
       ((QEQCAR |s2| 1)
        (COND
          ((SPADCALL (QCAR (QCDR |s2|)) (QCAR (QCDR |s2|))
               (QREFELT $ 26))
           (COND
             ((SPADCALL (QVELT (QCDR |s1|) 1) (QVELT (QCDR |s2|) 1)
                  (QREFELT $ 26))
              (EQL (QCDR (QCDR |s1|)) (QCDR (QCDR |s2|))))
             ('T 'NIL)))
          ('T 'NIL)))
       (#0# 'NIL)))
    (#0# 'NIL))) 

(DEFUN |UNISEG;coerce;$Of;15| (|s| $)
  (PROG (|e| |seg| |inc|)
    (RETURN
      (SEQ (LETT |seg|
                 (SEQ (LETT |e|
                            (SPADCALL (SPADCALL |s| (QREFELT $ 10))
                                (QREFELT $ 29))
                            . #0=(|UNISEG;coerce;$Of;15|))
                      (EXIT (COND
                              ((SPADCALL |s| (QREFELT $ 16))
                               (SPADCALL |e|
                                   (SPADCALL
                                    (SPADCALL |s| (QREFELT $ 11))
                                    (QREFELT $ 29))
                                   (QREFELT $ 30)))
                              ('T (SPADCALL |e| (QREFELT $ 31)))))) . #0#)
           (LETT |inc| (SPADCALL |s| (QREFELT $ 18)) . #0#)
           (EXIT (COND
                   ((EQL |inc| 1) |seg|)
                   ('T
                    (SPADCALL " by " |seg|
                        (SPADCALL |inc| (QREFELT $ 32)) (QREFELT $ 33))))))))) 

(DEFUN |UNISEG;expand;$S;16| (|s| $)
  (SPADCALL (LIST |s|) (QREFELT $ 37))) 

(DEFUN |UNISEG;map;M$S;17| (|f| |s| $)
  (SPADCALL |f| (SPADCALL |s| (QREFELT $ 38)) (QREFELT $ 40))) 

(DEFUN |UNISEG;plusInc| (|t| |a| $) (SPADCALL |t| |a| (QREFELT $ 42))) 

(DEFUN |UNISEG;expand;LS;19| (|ls| $)
  (PROG (|ns| |lb| |s| |st|)
    (RETURN
      (SEQ (LETT |st| (SPADCALL (QREFELT $ 43))
                 . #0=(|UNISEG;expand;LS;19|))
           (EXIT (COND
                   ((SPADCALL |ls| (QREFELT $ 45)) |st|)
                   (#1='T
                    (SEQ (LETT |lb| NIL . #0#)
                         (SEQ G190
                              (COND
                                ((NULL (COND
                                         ((SPADCALL |ls|
                                           (QREFELT $ 45))
                                          'NIL)
                                         ('T
                                          (SPADCALL
                                           (SPADCALL |ls|
                                            (QREFELT $ 46))
                                           (QREFELT $ 16)))))
                                 (GO G191)))
                              (SEQ (LETT |s|
                                    (SPADCALL |ls| (QREFELT $ 46)) . #0#)
                                   (LETT |ls|
                                    (SPADCALL |ls| (QREFELT $ 47)) . #0#)
                                   (LETT |ns|
                                    (SPADCALL
                                     (SPADCALL
                                      (SPADCALL |s| (QREFELT $ 10))
                                      (SPADCALL |s| (QREFELT $ 11))
                                      (QREFELT $ 48))
                                     (SPADCALL |s| (QREFELT $ 18))
                                     (QREFELT $ 49)) . #0#)
                                   (EXIT
                                    (LETT |lb|
                                     (SPADCALL |lb| |ns|
                                      (QREFELT $ 51)) . #0#)))
                              NIL (GO G190) G191 (EXIT NIL))
                         (COND
                           ((SPADCALL |ls| (QREFELT $ 45))
                            (LETT |st| (SPADCALL (QREFELT $ 43)) . #0#))
                           (#1#
                            (SEQ (LETT |s|
                                       (SPADCALL |ls| (QREFELT $ 46)) . #0#)
                                 (EXIT (LETT |st|
                                        (SPADCALL
                                         (CONS
                                          #'|UNISEG;expand;LS;19!0|
                                          (VECTOR $ |s|))
                                         (SPADCALL |s| (QREFELT $ 10))
                                         (QREFELT $ 53)) . #0#)))))
                         (EXIT (SPADCALL
                                   (SPADCALL
                                    (SPADCALL |lb| (QREFELT $ 55))
                                    (QREFELT $ 56))
                                   |st| (QREFELT $ 57))))))))))) 

(DEFUN |UNISEG;expand;LS;19!0| (|#1| $$)
  (PROG ($)
    (LETT $ (QREFELT $$ 0) |UNISEG;expand;LS;19|)
    (RETURN
      (PROGN
        (SPADCALL |#1|
            (SPADCALL (SPADCALL (QREFELT $$ 1) (QREFELT $ 18))
                (QREFELT $ 52))
            (QREFELT $ 42)))))) 

(DEFUN |UniversalSegment| (#0=#:G1910)
  (PROG ()
    (RETURN
      (PROG (#1=#:G1911)
        (RETURN
          (COND
            ((LETT #1#
                   (|lassocShiftWithFunction| (LIST (|devaluate| #0#))
                       (HGET |$ConstructorCache| '|UniversalSegment|)
                       '|domainEqualList|)
                   . #2=(|UniversalSegment|))
             (|CDRwithIncrement| #1#))
            ('T
             (UNWIND-PROTECT
               (PROG1 (|UniversalSegment;| #0#) (LETT #1# T . #2#))
               (COND
                 ((NOT #1#)
                  (HREM |$ConstructorCache| '|UniversalSegment|))))))))))) 

(DEFUN |UniversalSegment;| (|#1|)
  (PROG (DV$1 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #0=(|UniversalSegment|))
        (LETT |dv$| (LIST '|UniversalSegment| DV$1) . #0#)
        (LETT $ (GETREFV 60) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3
            (LETT |pv$|
                  (|buildPredVector| 0 0
                      (LIST (|HasCategory| |#1| '(|OrderedRing|))
                            (|HasCategory| |#1| '(|SetCategory|)))) . #0#))
        (|haddProp| |$ConstructorCache| '|UniversalSegment| (LIST DV$1)
            (CONS 1 $))
        (|stuffDomainSlots| $)
        (QSETREFV $ 6 |#1|)
        (QSETREFV $ 7
            (|Union| (|Record| (|:| |low| |#1|)
                         (|:| |incr| (|Integer|)))
                     (|Record| (|:| |low| |#1|) (|:| |high| |#1|)
                         (|:| |incr| (|Integer|)))))
        (COND
          ((|testBitVector| |pv$| 2)
           (PROGN
             (QSETREFV $ 27
                 (CONS (|dispatchFunction| |UNISEG;=;2$B;14|) $))
             (QSETREFV $ 34
                 (CONS (|dispatchFunction| |UNISEG;coerce;$Of;15|) $)))))
        (COND
          ((|testBitVector| |pv$| 1)
           (PROGN
             (QSETREFV $ 38
                 (CONS (|dispatchFunction| |UNISEG;expand;$S;16|) $))
             (QSETREFV $ 41
                 (CONS (|dispatchFunction| |UNISEG;map;M$S;17|) $))
             (QSETREFV $ 37
                 (CONS (|dispatchFunction| |UNISEG;expand;LS;19|) $)))))
        $)))) 

(MAKEPROP '|UniversalSegment| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) '|Rep|
             |UNISEG;segment;S$;1| |UNISEG;segment;2S$;2|
             |UNISEG;lo;$S;4| |UNISEG;hi;$S;7| (|Integer|)
             |UNISEG;BY;$I$;3| |UNISEG;low;$S;5| (|Boolean|)
             |UNISEG;hasHi;$B;6| |UNISEG;high;$S;8| |UNISEG;incr;$I;9|
             |UNISEG;SEGMENT;S$;10| |UNISEG;SEGMENT;2S$;11|
             (|Segment| 6) (0 . |lo|) (5 . |hi|) |UNISEG;coerce;S$;12|
             |UNISEG;convert;S$;13| (10 . =) (16 . =) (|OutputForm|)
             (22 . |coerce|) (27 . SEGMENT) (33 . SEGMENT)
             (38 . |coerce|) (43 . |infix|) (50 . |coerce|)
             (|Stream| 6) (|List| $) (55 . |expand|) (60 . |expand|)
             (|Mapping| 6 6) (65 . |map|) (71 . |map|) (77 . +)
             (83 . |empty|) (|List| $$) (87 . |null|) (92 . |first|)
             (97 . |rest|) (102 . SEGMENT) (108 . BY) (|List| 21)
             (114 . |concat!|) (120 . |coerce|) (125 . |generate|)
             (|List| 6) (131 . |expand|) (136 . |construct|)
             (141 . |concat|) (|String|) (|SingleInteger|))
          '#(~= 147 |segment| 153 |map| 164 |low| 170 |lo| 175 |latex|
             180 |incr| 185 |high| 190 |hi| 195 |hash| 200 |hasHi| 205
             |expand| 210 |convert| 220 |coerce| 225 SEGMENT 235 BY 246
             = 252)
          'NIL
          (CONS (|makeByteWordVec2| 2 '(1 0 2 0 2 2))
                (CONS '#(NIL NIL |SetCategory&| NIL |BasicType&| NIL)
                      (CONS '#((|SegmentExpansionCategory| 6
                                   (|Stream| 6))
                               (|SegmentCategory| 6) (|SetCategory|)
                               (|Type|) (|BasicType|)
                               (|CoercibleTo| 28))
                            (|makeByteWordVec2| 59
                                '(1 21 6 0 22 1 21 6 0 23 2 6 15 0 0 26
                                  2 0 15 0 0 27 1 6 28 0 29 2 28 0 0 0
                                  30 1 28 0 0 31 1 12 28 0 32 3 28 0 0
                                  0 0 33 1 0 28 0 34 1 0 35 36 37 1 0
                                  35 0 38 2 35 0 39 0 40 2 0 35 39 0 41
                                  2 6 0 0 0 42 0 35 0 43 1 44 15 0 45 1
                                  44 2 0 46 1 44 0 0 47 2 21 0 6 6 48 2
                                  21 0 0 12 49 2 50 0 0 21 51 1 6 0 12
                                  52 2 35 0 39 6 53 1 21 54 36 55 1 35
                                  0 54 56 2 35 0 0 0 57 2 2 15 0 0 1 1
                                  0 0 6 8 2 0 0 6 6 9 2 1 35 39 0 41 1
                                  0 6 0 14 1 0 6 0 10 1 2 58 0 1 1 0 12
                                  0 18 1 0 6 0 17 1 0 6 0 11 1 2 59 0 1
                                  1 0 15 0 16 1 1 35 0 38 1 1 35 36 37
                                  1 0 0 6 25 1 2 28 0 34 1 0 0 21 24 1
                                  0 0 6 19 2 0 0 6 6 20 2 0 0 0 12 13 2
                                  2 15 0 0 27)))))
          '|lookupComplete|)) 
