
(/VERSIONCHECK 2) 

(DEFUN |HEAP;empty;$;1| ($) (SPADCALL (QREFELT $ 8))) 

(DEFUN |HEAP;heap;L$;2| (|l| $)
  (PROG (|n| |h| |x| #0=#:G1825)
    (RETURN
      (SEQ (LETT |n| (LENGTH |l|) . #1=(|HEAP;heap;L$;2|))
           (LETT |h| (SPADCALL (QREFELT $ 9)) . #1#)
           (EXIT (COND
                   ((EQL |n| 0) |h|)
                   ('T
                    (SEQ (SEQ (LETT |x| NIL . #1#) (LETT #0# |l| . #1#)
                              G190
                              (COND
                                ((OR (ATOM #0#)
                                     (PROGN
                                       (LETT |x| (CAR #0#) . #1#)
                                       NIL))
                                 (GO G191)))
                              (SEQ (EXIT
                                    (SPADCALL |x| |h| (QREFELT $ 10))))
                              (LETT #0# (CDR #0#) . #1#) (GO G190) G191
                              (EXIT NIL))
                         (EXIT |h|))))))))) 

(DEFUN |HEAP;siftUp| (|r| |i| |n| $)
  (PROG (|t| |k| |j| #0=#:G1830)
    (RETURN
      (SEQ (LETT |t| (SPADCALL |r| |i| (QREFELT $ 14))
                 . #1=(|HEAP;siftUp|))
           (EXIT (SEQ (EXIT (SEQ G190
                                 (COND
                                   ((NULL
                                     (<
                                      (LETT |j|
                                       (+
                                        (SPADCALL 2 |i| (QREFELT $ 16))
                                        1) . #1#)
                                      |n|))
                                    (GO G191)))
                                 (SEQ (SEQ (LETT |k| (+ |j| 1) . #1#)
                                       (EXIT
                                        (COND
                                          ((< |k| |n|)
                                           (COND
                                             ((SPADCALL
                                               (SPADCALL |r| |j|
                                                (QREFELT $ 14))
                                               (SPADCALL |r| |k|
                                                (QREFELT $ 14))
                                               (QREFELT $ 18))
                                              (LETT |j| |k| . #1#)))))))
                                      (EXIT
                                       (COND
                                         ((SPADCALL |t|
                                           (SPADCALL |r| |j|
                                            (QREFELT $ 14))
                                           (QREFELT $ 18))
                                          (SEQ
                                           (SPADCALL |r| |i|
                                            (SPADCALL |r| |j|
                                             (QREFELT $ 14))
                                            (QREFELT $ 19))
                                           (SPADCALL |r| |j| |t|
                                            (QREFELT $ 19))
                                           (EXIT (LETT |i| |j| . #1#))))
                                         ('T
                                          (PROGN
                                            (LETT #0# |$NoValue| . #1#)
                                            (GO #0#))))))
                                 NIL (GO G190) G191 (EXIT NIL)))
                      #0# (EXIT #0#))))))) 

(DEFUN |HEAP;extract!;$S;4| (|r| $)
  (PROG (|n| |t|)
    (RETURN
      (SEQ (LETT |n| (SPADCALL |r| (QREFELT $ 21))
                 . #0=(|HEAP;extract!;$S;4|))
           (EXIT (COND
                   ((EQL |n| 0) (|error| "empty heap"))
                   (#1='T
                    (SEQ (LETT |t|
                               (SPADCALL |r| 0 (QREFELT $ 14)) . #0#)
                         (SPADCALL |r| 0
                             (SPADCALL |r| (- |n| 1) (QREFELT $ 14))
                             (QREFELT $ 19))
                         (SPADCALL |r| (- |n| 1) (QREFELT $ 22))
                         (EXIT (COND
                                 ((EQL |n| 1) |t|)
                                 (#1#
                                  (SEQ (|HEAP;siftUp| |r| 0 (- |n| 1)
                                        $)
                                       (EXIT |t|))))))))))))) 

(DEFUN |HEAP;insert!;S2$;5| (|x| |r| $)
  (PROG (|i| #0=#:G1839 |j|)
    (RETURN
      (SEQ (LETT |j| (SPADCALL |r| (QREFELT $ 21))
                 . #1=(|HEAP;insert!;S2$;5|))
           (LETT |r|
                 (SPADCALL |r|
                     (SPADCALL |x| (SPADCALL (QREFELT $ 8))
                         (QREFELT $ 24))
                     (QREFELT $ 25)) . #1#)
           (SEQ (EXIT (SEQ G190 (COND ((NULL (< 0 |j|)) (GO G191)))
                           (SEQ (LETT |i|
                                      (QUOTIENT2 (- |j| 1) 2) . #1#)
                                (COND
                                  ((NULL
                                    (SPADCALL
                                     (SPADCALL |r| |i| (QREFELT $ 14))
                                     |x| (QREFELT $ 18)))
                                   (PROGN
                                     (LETT #0# |$NoValue| . #1#)
                                     (GO #0#))))
                                (SPADCALL |r| |j|
                                    (SPADCALL |r| |i| (QREFELT $ 14))
                                    (QREFELT $ 19))
                                (EXIT (LETT |j| |i| . #1#)))
                           NIL (GO G190) G191 (EXIT NIL)))
                #0# (EXIT #0#))
           (SPADCALL |r| |j| |x| (QREFELT $ 19)) (EXIT |r|))))) 

(DEFUN |HEAP;max;$S;6| (|r| $)
  (COND
    ((EQL (SPADCALL |r| (QREFELT $ 21)) 0) (|error| "empty heap"))
    ('T (SPADCALL |r| 0 (QREFELT $ 14))))) 

(DEFUN |HEAP;inspect;$S;7| (|r| $) (SPADCALL |r| (QREFELT $ 26))) 

(DEFUN |HEAP;makeHeap| (|r| $)
  (PROG (|n| |k|)
    (RETURN
      (SEQ (LETT |n| (SPADCALL |r| (QREFELT $ 21))
                 . #0=(|HEAP;makeHeap|))
           (SEQ (LETT |k| (- (QUOTIENT2 |n| 2) 1) . #0#) G190
                (COND ((< |k| 0) (GO G191)))
                (SEQ (EXIT (|HEAP;siftUp| |r| |k| |n| $)))
                (LETT |k| (+ |k| -1) . #0#) (GO G190) G191 (EXIT NIL))
           (EXIT |r|))))) 

(DEFUN |HEAP;bag;L$;9| (|l| $)
  (|HEAP;makeHeap| (SPADCALL |l| (QREFELT $ 28)) $)) 

(DEFUN |HEAP;merge;3$;10| (|a| |b| $)
  (|HEAP;makeHeap| (SPADCALL |a| |b| (QREFELT $ 30)) $)) 

(DEFUN |HEAP;merge!;3$;11| (|a| |b| $)
  (|HEAP;makeHeap| (SPADCALL |a| |b| (QREFELT $ 25)) $)) 

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

(DEFUN |Heap;| (|#1|)
  (PROG (DV$1 |dv$| $ #0=#:G1853 |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #1=(|Heap|))
        (LETT |dv$| (LIST '|Heap| DV$1) . #1#)
        (LETT $ (GETREFV 40) . #1#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3
            (LETT |pv$|
                  (|buildPredVector| 0 0
                      (LIST (LETT #0#
                                  (|HasCategory| |#1| '(|SetCategory|)) . #1#)
                            (AND #0#
                                 (|HasCategory| |#1|
                                     (LIST '|Evalable|
                                      (|devaluate| |#1|)))))) . #1#))
        (|haddProp| |$ConstructorCache| '|Heap| (LIST DV$1) (CONS 1 $))
        (|stuffDomainSlots| $)
        (QSETREFV $ 6 |#1|)
        (AND (|HasCategory| $ '(|shallowlyMutable|))
             (|augmentPredVector| $ 4))
        (AND (|HasCategory| $ '(|finiteAggregate|))
             (|augmentPredVector| $ 8))
        (AND (|HasCategory| $ '(|finiteAggregate|)) #0#
             (|augmentPredVector| $ 16))
        (QSETREFV $ 7 (|IndexedFlexibleArray| |#1| 0))
        $)))) 

(MAKEPROP '|Heap| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL (|IndexedFlexibleArray| 6 (NRTEVAL 0))
             (|local| |#1|) '|Rep| (0 . |empty|) |HEAP;empty;$;1|
             |HEAP;insert!;S2$;5| (|List| 6) |HEAP;heap;L$;2|
             (|Integer|) (4 . |elt|) (|PositiveInteger|) (10 . *)
             (|Boolean|) (16 . <) (22 . |setelt|)
             (|NonNegativeInteger|) (29 . |#|) (34 . |delete!|)
             |HEAP;extract!;$S;4| (40 . |concat|) (46 . |concat!|)
             |HEAP;max;$S;6| |HEAP;inspect;$S;7| (52 . |construct|)
             |HEAP;bag;L$;9| (57 . |concat|) |HEAP;merge;3$;10|
             |HEAP;merge!;3$;11| (|List| 34) (|Equation| 6)
             (|Mapping| 17 6) (|Mapping| 6 6) (|SingleInteger|)
             (|OutputForm|) (|String|))
          '#(~= 63 |size?| 69 |sample| 75 |parts| 79 |more?| 84
             |merge!| 90 |merge| 96 |members| 102 |member?| 107 |max|
             113 |map!| 118 |map| 124 |less?| 130 |latex| 136 |inspect|
             141 |insert!| 146 |heap| 152 |hash| 157 |extract!| 162
             |every?| 167 |eval| 173 |eq?| 199 |empty?| 205 |empty| 210
             |count| 214 |copy| 226 |coerce| 231 |bag| 236 |any?| 241 =
             247 |#| 253)
          'NIL
          (CONS (|makeByteWordVec2| 2 '(0 0 0 0 2 1 0 0 0 2 1 1))
                (CONS '#(NIL |BagAggregate&| |HomogeneousAggregate&|
                         |Aggregate&| |Evalable&| |SetCategory&| NIL
                         NIL NIL |InnerEvalable&| |BasicType&| NIL)
                      (CONS '#((|PriorityQueueAggregate| 6)
                               (|BagAggregate| 6)
                               (|HomogeneousAggregate| 6) (|Aggregate|)
                               (|Evalable| 6) (|SetCategory|) (|Type|)
                               (|finiteAggregate|) (|shallowlyMutable|)
                               (|InnerEvalable| 6 6) (|BasicType|)
                               (|CoercibleTo| 38))
                            (|makeByteWordVec2| 39
                                '(0 7 0 8 2 7 6 0 13 14 2 13 0 15 0 16
                                  2 6 17 0 0 18 3 7 6 0 13 6 19 1 0 20
                                  0 21 2 7 0 0 13 22 2 7 0 6 0 24 2 7 0
                                  0 0 25 1 7 0 11 28 2 7 0 0 0 30 2 1
                                  17 0 0 1 2 0 17 0 20 1 0 0 0 1 1 4 11
                                  0 1 2 0 17 0 20 1 2 0 0 0 0 32 2 0 0
                                  0 0 31 1 4 11 0 1 2 5 17 6 0 1 1 0 6
                                  0 26 2 3 0 36 0 1 2 0 0 36 0 1 2 0 17
                                  0 20 1 1 1 39 0 1 1 0 6 0 27 2 0 0 6
                                  0 10 1 0 0 11 12 1 1 37 0 1 1 0 6 0
                                  23 2 4 17 35 0 1 3 2 0 0 11 11 1 3 2
                                  0 0 6 6 1 2 2 0 0 33 1 2 2 0 0 34 1 2
                                  0 17 0 0 1 1 0 17 0 1 0 0 0 9 2 5 20
                                  6 0 1 2 4 20 35 0 1 1 0 0 0 1 1 1 38
                                  0 1 1 0 0 11 29 2 4 17 35 0 1 2 1 17
                                  0 0 1 1 4 20 0 21)))))
          '|lookupComplete|)) 
