
(/VERSIONCHECK 2) 

(PUT '|SEG;SEGMENT;2S$;1| '|SPADreplace|
     '(XLAM (|a| |b|) (VECTOR |a| |b| 1))) 

(DEFUN |SEG;SEGMENT;2S$;1| (|a| |b| $) (VECTOR |a| |b| 1)) 

(PUT '|SEG;lo;$S;2| '|SPADreplace| '(XLAM (|s|) (QVELT |s| 0))) 

(DEFUN |SEG;lo;$S;2| (|s| $) (QVELT |s| 0)) 

(PUT '|SEG;low;$S;3| '|SPADreplace| '(XLAM (|s|) (QVELT |s| 0))) 

(DEFUN |SEG;low;$S;3| (|s| $) (QVELT |s| 0)) 

(PUT '|SEG;hi;$S;4| '|SPADreplace| '(XLAM (|s|) (QVELT |s| 1))) 

(DEFUN |SEG;hi;$S;4| (|s| $) (QVELT |s| 1)) 

(PUT '|SEG;high;$S;5| '|SPADreplace| '(XLAM (|s|) (QVELT |s| 1))) 

(DEFUN |SEG;high;$S;5| (|s| $) (QVELT |s| 1)) 

(PUT '|SEG;incr;$I;6| '|SPADreplace| '(XLAM (|s|) (QVELT |s| 2))) 

(DEFUN |SEG;incr;$I;6| (|s| $) (QVELT |s| 2)) 

(PUT '|SEG;segment;2S$;7| '|SPADreplace|
     '(XLAM (|a| |b|) (VECTOR |a| |b| 1))) 

(DEFUN |SEG;segment;2S$;7| (|a| |b| $) (VECTOR |a| |b| 1)) 

(DEFUN |SEG;BY;$I$;8| (|s| |r| $)
  (VECTOR (SPADCALL |s| (QREFELT $ 9)) (SPADCALL |s| (QREFELT $ 11))
          |r|)) 

(DEFUN |SEG;=;2$B;9| (|s1| |s2| $)
  (COND
    ((SPADCALL (QVELT |s1| 0) (QVELT |s2| 0) (QREFELT $ 18))
     (COND
       ((SPADCALL (QVELT |s1| 1) (QVELT |s2| 1) (QREFELT $ 18))
        (EQL (QVELT |s1| 2) (QVELT |s2| 2)))
       ('T 'NIL)))
    ('T 'NIL))) 

(DEFUN |SEG;coerce;$Of;10| (|s| $)
  (PROG (|seg|)
    (RETURN
      (SEQ (LETT |seg|
                 (SPADCALL (SPADCALL (QVELT |s| 0) (QREFELT $ 21))
                     (SPADCALL (QVELT |s| 1) (QREFELT $ 21))
                     (QREFELT $ 22))
                 |SEG;coerce;$Of;10|)
           (EXIT (COND
                   ((EQL (QVELT |s| 2) 1) |seg|)
                   ('T
                    (SPADCALL " by " |seg|
                        (SPADCALL (QVELT |s| 2) (QREFELT $ 23))
                        (QREFELT $ 24))))))))) 

(PUT '|SEG;convert;S$;11| '|SPADreplace|
     '(XLAM (|a|) (VECTOR |a| |a| 1))) 

(DEFUN |SEG;convert;S$;11| (|a| $) (VECTOR |a| |a| 1)) 

(DEFUN |SEG;expand;LL;12| (|ls| $)
  (PROG (|s| #0=#:G1845 |h| |inc| |lr| |l|)
    (RETURN
      (SEQ (LETT |lr| NIL . #1=(|SEG;expand;LL;12|))
           (SEQ (LETT |s| NIL . #1#) (LETT #0# |ls| . #1#) G190
                (COND
                  ((OR (ATOM #0#)
                       (PROGN (LETT |s| (CAR #0#) . #1#) NIL))
                   #2=(GO G191)))
                (SEQ (LETT |l| (SPADCALL |s| (QREFELT $ 9)) . #1#)
                     (LETT |h| (SPADCALL |s| (QREFELT $ 11)) . #1#)
                     (LETT |inc|
                           (SPADCALL (SPADCALL |s| (QREFELT $ 14))
                               (QREFELT $ 27)) . #1#)
                     (EXIT (COND
                             ((SPADCALL |inc| (QREFELT $ 28))
                              (|error| "Cannot expand a segment with an increment of zero"))
                             ((SPADCALL (|spadConstant| $ 29) |inc|
                                  (QREFELT $ 30))
                              (SEQ G190
                                   (COND
                                     ((NULL
                                       (COND
                                         ((SPADCALL |h| |l|
                                           (QREFELT $ 30))
                                          'NIL)
                                         ('T 'T)))
                                      #2#))
                                   (SEQ
                                    (LETT |lr| (CONS |l| |lr|) . #1#)
                                    (EXIT
                                     (LETT |l|
                                      (SPADCALL |l| |inc|
                                       (QREFELT $ 31)) . #1#)))
                                   NIL #3=(GO G190) G191 (EXIT NIL)))
                             ('T
                              (SEQ G190
                                   (COND
                                     ((NULL
                                       (COND
                                         ((SPADCALL |l| |h|
                                           (QREFELT $ 30))
                                          'NIL)
                                         ('T 'T)))
                                      #2#))
                                   (SEQ
                                    (LETT |lr| (CONS |l| |lr|) . #1#)
                                    (EXIT
                                     (LETT |l|
                                      (SPADCALL |l| |inc|
                                       (QREFELT $ 31)) . #1#)))
                                   NIL #3# G191 (EXIT NIL))))))
                (LETT #0# (CDR #0#) . #1#) #3# G191 (EXIT NIL))
           (EXIT (NREVERSE |lr|)))))) 

(DEFUN |SEG;expand;$L;13| (|s| $)
  (SPADCALL (LIST |s|) (QREFELT $ 34))) 

(DEFUN |SEG;map;M$L;14| (|f| |s| $)
  (PROG (|h| |inc| |lr| |l|)
    (RETURN
      (SEQ (LETT |lr| NIL . #0=(|SEG;map;M$L;14|))
           (LETT |l| (SPADCALL |s| (QREFELT $ 9)) . #0#)
           (LETT |h| (SPADCALL |s| (QREFELT $ 11)) . #0#)
           (LETT |inc|
                 (SPADCALL (SPADCALL |s| (QREFELT $ 14))
                     (QREFELT $ 27)) . #0#)
           (COND
             ((SPADCALL (|spadConstant| $ 29) |inc| (QREFELT $ 30))
              (SEQ G190
                   (COND
                     ((NULL (COND
                              ((SPADCALL |h| |l| (QREFELT $ 30)) 'NIL)
                              ('T 'T)))
                      #1=(GO G191)))
                   (SEQ (LETT |lr|
                              (CONS (SPADCALL |l| |f|) |lr|) . #0#)
                        (EXIT (LETT |l|
                                    (SPADCALL |l| |inc| (QREFELT $ 31)) . #0#)))
                   NIL #2=(GO G190) G191 (EXIT NIL)))
             ('T
              (SEQ G190
                   (COND
                     ((NULL (COND
                              ((SPADCALL |l| |h| (QREFELT $ 30)) 'NIL)
                              ('T 'T)))
                      #1#))
                   (SEQ (LETT |lr|
                              (CONS (SPADCALL |l| |f|) |lr|) . #0#)
                        (EXIT (LETT |l|
                                    (SPADCALL |l| |inc| (QREFELT $ 31)) . #0#)))
                   NIL #2# G191 (EXIT NIL))))
           (EXIT (NREVERSE |lr|)))))) 

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

(DEFUN |Segment;| (|#1|)
  (PROG (DV$1 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #0=(|Segment|))
        (LETT |dv$| (LIST '|Segment| DV$1) . #0#)
        (LETT $ (GETREFV 40) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3
            (LETT |pv$|
                  (|buildPredVector| 0 0
                      (LIST (|HasCategory| |#1| '(|OrderedRing|))
                            (|HasCategory| |#1| '(|SetCategory|)))) . #0#))
        (|haddProp| |$ConstructorCache| '|Segment| (LIST DV$1)
            (CONS 1 $))
        (|stuffDomainSlots| $)
        (QSETREFV $ 6 |#1|)
        (QSETREFV $ 7
            (|Record| (|:| |low| |#1|) (|:| |high| |#1|)
                (|:| |incr| (|Integer|))))
        (COND
          ((|testBitVector| |pv$| 2)
           (PROGN
             (QSETREFV $ 19
                 (CONS (|dispatchFunction| |SEG;=;2$B;9|) $))
             (QSETREFV $ 25
                 (CONS (|dispatchFunction| |SEG;coerce;$Of;10|) $)))))
        (COND
          ((|testBitVector| |pv$| 1)
           (PROGN
             (QSETREFV $ 34
                 (CONS (|dispatchFunction| |SEG;expand;LL;12|) $))
             (QSETREFV $ 35
                 (CONS (|dispatchFunction| |SEG;expand;$L;13|) $))
             (QSETREFV $ 37
                 (CONS (|dispatchFunction| |SEG;map;M$L;14|) $)))))
        $)))) 

(MAKEPROP '|Segment| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) '|Rep|
             |SEG;SEGMENT;2S$;1| |SEG;lo;$S;2| |SEG;low;$S;3|
             |SEG;hi;$S;4| |SEG;high;$S;5| (|Integer|) |SEG;incr;$I;6|
             |SEG;segment;2S$;7| |SEG;BY;$I$;8| (|Boolean|) (0 . =)
             (6 . =) (|OutputForm|) (12 . |coerce|) (17 . SEGMENT)
             (23 . |coerce|) (28 . |infix|) (35 . |coerce|)
             |SEG;convert;S$;11| (40 . |coerce|) (45 . |zero?|)
             (50 . |Zero|) (54 . <) (60 . +) (|List| 6) (|List| $)
             (66 . |expand|) (71 . |expand|) (|Mapping| 6 6)
             (76 . |map|) (|SingleInteger|) (|String|))
          '#(~= 82 |segment| 88 |map| 94 |low| 100 |lo| 105 |latex| 110
             |incr| 115 |high| 120 |hi| 125 |hash| 130 |expand| 135
             |convert| 145 |coerce| 150 SEGMENT 155 BY 161 = 167)
          'NIL
          (CONS (|makeByteWordVec2| 2 '(1 0 2 0 2 2))
                (CONS '#(NIL NIL |SetCategory&| NIL |BasicType&| NIL)
                      (CONS '#((|SegmentExpansionCategory| 6
                                   (|List| 6))
                               (|SegmentCategory| 6) (|SetCategory|)
                               (|Type|) (|BasicType|)
                               (|CoercibleTo| 20))
                            (|makeByteWordVec2| 39
                                '(2 6 17 0 0 18 2 0 17 0 0 19 1 6 20 0
                                  21 2 20 0 0 0 22 1 13 20 0 23 3 20 0
                                  0 0 0 24 1 0 20 0 25 1 6 0 13 27 1 6
                                  17 0 28 0 6 0 29 2 6 17 0 0 30 2 6 0
                                  0 0 31 1 0 32 33 34 1 0 32 0 35 2 0
                                  32 36 0 37 2 2 17 0 0 1 2 0 0 6 6 15
                                  2 1 32 36 0 37 1 0 6 0 10 1 0 6 0 9 1
                                  2 39 0 1 1 0 13 0 14 1 0 6 0 12 1 0 6
                                  0 11 1 2 38 0 1 1 1 32 33 34 1 1 32 0
                                  35 1 0 0 6 26 1 2 20 0 25 2 0 0 6 6 8
                                  2 0 0 0 13 16 2 2 17 0 0 19)))))
          '|lookupComplete|)) 
