
(/VERSIONCHECK 2) 

(PUT '|PRTITION;Zero;$;1| '|SPADreplace| '(XLAM NIL NIL)) 

(DEFUN |PRTITION;Zero;$;1| ($) NIL) 

(PUT '|PRTITION;coerce;$L;2| '|SPADreplace| '(XLAM (|s|) |s|)) 

(DEFUN |PRTITION;coerce;$L;2| (|s| $) |s|) 

(DEFUN |PRTITION;convert;$L;3| (|x| $) (SPADCALL |x| (QREFELT $ 10))) 

(DEFUN |PRTITION;partition;L$;4| (|list| $)
  (SPADCALL (CONS #'|PRTITION;partition;L$;4!0| $) |list|
      (QREFELT $ 16))) 

(DEFUN |PRTITION;partition;L$;4!0| (|#1| |#2| $)
  (SPADCALL |#2| |#1| (QREFELT $ 14))) 

(DEFUN |PRTITION;<;2$B;5| (|x| |y| $)
  (COND
    ((NULL |x|) (COND ((NULL |y|) 'NIL) ('T 'T)))
    ((NULL |y|) 'NIL)
    ((EQL (|SPADfirst| |x|) (|SPADfirst| |y|))
     (SPADCALL (CDR |x|) (CDR |y|) (QREFELT $ 18)))
    ('T (< (|SPADfirst| |x|) (|SPADfirst| |y|))))) 

(PUT '|PRTITION;=;2$B;6| '|SPADreplace| 'EQUAL) 

(DEFUN |PRTITION;=;2$B;6| (|x| |y| $) (EQUAL |x| |y|)) 

(DEFUN |PRTITION;+;3$;7| (|x| |y| $)
  (COND
    ((NULL |x|) |y|)
    ((NULL |y|) |x|)
    ((< (|SPADfirst| |y|) (|SPADfirst| |x|))
     (CONS (|SPADfirst| |x|) (SPADCALL (CDR |x|) |y| (QREFELT $ 20))))
    ('T
     (CONS (|SPADfirst| |y|) (SPADCALL |x| (CDR |y|) (QREFELT $ 20)))))) 

(DEFUN |PRTITION;*;Nni2$;8| (|n| |x| $)
  (PROG (#0=#:G1856)
    (RETURN
      (COND
        ((ZEROP |n|) (|spadConstant| $ 7))
        ('T
         (SPADCALL |x|
             (SPADCALL
                 (PROG2 (LETT #0# (SPADCALL |n| 1 (QREFELT $ 23))
                              |PRTITION;*;Nni2$;8|)
                        (QCDR #0#)
                   (|check-union| (QEQCAR #0# 0) (|NonNegativeInteger|)
                       #0#))
                 |x| (QREFELT $ 24))
             (QREFELT $ 20))))))) 

(DEFUN |PRTITION;dp| (|i| |x| $)
  (COND
    ((NULL |x|) (|spadConstant| $ 7))
    ((EQL (|SPADfirst| |x|) |i|) (CDR |x|))
    ('T (CONS (|SPADfirst| |x|) (|PRTITION;dp| |i| (CDR |x|) $))))) 

(DEFUN |PRTITION;remv| (|i| |x| $)
  (COND
    ((SPADCALL |i| |x| (QREFELT $ 25))
     (CONS 0 (|PRTITION;dp| |i| |x| $)))
    ('T (CONS 1 "failed")))) 

(DEFUN |PRTITION;subtractIfCan;2$U;11| (|x| |y| $)
  (PROG (|aa|)
    (RETURN
      (SEQ (COND
             ((NULL |x|)
              (COND
                ((NULL |y|) (CONS 0 (|spadConstant| $ 7)))
                ('T (CONS 1 "failed"))))
             ((NULL |y|) (CONS 0 |x|))
             ('T
              (SEQ (LETT |aa| (|PRTITION;remv| (|SPADfirst| |y|) |x| $)
                         |PRTITION;subtractIfCan;2$U;11|)
                   (EXIT (COND
                           ((QEQCAR |aa| 1) (CONS 1 "failed"))
                           ('T
                            (SPADCALL (QCDR |aa|) (CDR |y|)
                                (QREFELT $ 26)))))))))))) 

(DEFUN |PRTITION;bite| (|i| |li| $)
  (PROG (|li1|)
    (RETURN
      (SEQ (COND
             ((NULL |li|) (CONS 0 NIL))
             ((EQL (|SPADfirst| |li|) |i|)
              (SEQ (LETT |li1| (|PRTITION;bite| |i| (CDR |li|) $)
                         |PRTITION;bite|)
                   (EXIT (CONS (+ (|SPADfirst| |li1|) 1) (CDR |li1|)))))
             ('T (CONS 0 |li|))))))) 

(DEFUN |PRTITION;powers;LL;13| (|l| $)
  (PROG (|li|)
    (RETURN
      (SEQ (COND
             ((NULL |l|) NIL)
             ('T
              (SEQ (LETT |li|
                         (|PRTITION;bite| (|SPADfirst| |l|) (CDR |l|)
                             $)
                         |PRTITION;powers;LL;13|)
                   (EXIT (CONS (LIST (|SPADfirst| |l|)
                                     (+ (|SPADfirst| |li|) 1))
                               (SPADCALL (CDR |li|) (QREFELT $ 28))))))))))) 

(DEFUN |PRTITION;conjugate;2$;14| (|x| $)
  (SPADCALL |x| (QREFELT $ 30))) 

(DEFUN |PRTITION;mkterm| (|i1| |i2| $)
  (COND
    ((EQL |i2| 1)
     (SPADCALL (SPADCALL |i1| (QREFELT $ 33)) " " (QREFELT $ 34)))
    ('T
     (SPADCALL (SPADCALL |i1| (QREFELT $ 33))
         (SPADCALL |i2| (QREFELT $ 33)) (QREFELT $ 34))))) 

(DEFUN |PRTITION;mkexp1| (|lli| $)
  (PROG (|li|)
    (RETURN
      (SEQ (COND
             ((NULL |lli|) NIL)
             ('T
              (SEQ (LETT |li| (|SPADfirst| |lli|) |PRTITION;mkexp1|)
                   (COND
                     ((NULL (CDR |lli|))
                      (COND
                        ((EQL (SPADCALL |li| (QREFELT $ 35)) 1)
                         (EXIT (CONS (SPADCALL (|SPADfirst| |li|)
                                      (QREFELT $ 33))
                                     NIL))))))
                   (EXIT (CONS (|PRTITION;mkterm| (|SPADfirst| |li|)
                                   (SPADCALL |li| (QREFELT $ 35)) $)
                               (|PRTITION;mkexp1| (CDR |lli|) $)))))))))) 

(DEFUN |PRTITION;coerce;$Of;17| (|x| $)
  (COND
    ((NULL |x|) (SPADCALL |x| (QREFELT $ 36)))
    ('T
     (SPADCALL
         (SPADCALL (ELT $ 37)
             (|PRTITION;mkexp1| (SPADCALL |x| (QREFELT $ 28)) $)
             (QREFELT $ 40))
         (QREFELT $ 41))))) 

(DEFUN |PRTITION;pdct;$I;18| (|x| $)
  (PROG (|a| #0=#:G1897 #1=#:G1895 #2=#:G1893 #3=#:G1894)
    (RETURN
      (SEQ (PROGN
             (LETT #3# NIL . #4=(|PRTITION;pdct;$I;18|))
             (SEQ (LETT |a| NIL . #4#)
                  (LETT #0# (SPADCALL |x| (QREFELT $ 28)) . #4#) G190
                  (COND
                    ((OR (ATOM #0#)
                         (PROGN (LETT |a| (CAR #0#) . #4#) NIL))
                     (GO G191)))
                  (SEQ (EXIT (PROGN
                               (LETT #1#
                                     (*
                                      (SPADCALL
                                       (SPADCALL |a| (QREFELT $ 35))
                                       (QREFELT $ 43))
                                      (EXPT (|SPADfirst| |a|)
                                       (SPADCALL |a| (QREFELT $ 35)))) . #4#)
                               (COND
                                 (#3# (LETT #2# (* #2# #1#) . #4#))
                                 ('T
                                  (PROGN
                                    (LETT #2# #1# . #4#)
                                    (LETT #3# 'T . #4#)))))))
                  (LETT #0# (CDR #0#) . #4#) (GO G190) G191 (EXIT NIL))
             (COND (#3# #2#) ('T 1))))))) 

(DEFUN |Partition| ()
  (PROG ()
    (RETURN
      (PROG (#0=#:G1899)
        (RETURN
          (COND
            ((LETT #0# (HGET |$ConstructorCache| '|Partition|)
                   . #1=(|Partition|))
             (|CDRwithIncrement| (CDAR #0#)))
            ('T
             (UNWIND-PROTECT
               (PROG1 (CDDAR (HPUT |$ConstructorCache| '|Partition|
                                   (LIST
                                    (CONS NIL (CONS 1 (|Partition;|))))))
                 (LETT #0# T . #1#))
               (COND
                 ((NOT #0#) (HREM |$ConstructorCache| '|Partition|))))))))))) 

(DEFUN |Partition;| ()
  (PROG (|dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT |dv$| '(|Partition|) . #0=(|Partition|))
        (LETT $ (GETREFV 48) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|haddProp| |$ConstructorCache| '|Partition| NIL (CONS 1 $))
        (|stuffDomainSlots| $)
        (QSETREFV $ 6 (|List| (|Integer|)))
        $)))) 

(MAKEPROP '|Partition| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL '|Rep|
             (CONS IDENTITY
                   (FUNCALL (|dispatchFunction| |PRTITION;Zero;$;1|) $))
             (|List| 13) |PRTITION;coerce;$L;2| (0 . |copy|)
             |PRTITION;convert;$L;3| (|Boolean|) (|Integer|) (5 . <)
             (|Mapping| 12 13 13) (11 . |sort|)
             |PRTITION;partition;L$;4| |PRTITION;<;2$B;5|
             |PRTITION;=;2$B;6| |PRTITION;+;3$;7| (|Union| $ '"failed")
             (|NonNegativeInteger|) (17 . |subtractIfCan|)
             |PRTITION;*;Nni2$;8| (23 . |member?|)
             |PRTITION;subtractIfCan;2$U;11| (|List| 8)
             |PRTITION;powers;LL;13| (|PartitionsAndPermutations|)
             (29 . |conjugate|) |PRTITION;conjugate;2$;14|
             (|OutputForm|) (34 . |coerce|) (39 . **) (45 . |second|)
             (50 . |coerce|) (55 . *) (|Mapping| 32 32 32) (|List| 32)
             (61 . |reduce|) (67 . |paren|) |PRTITION;coerce;$Of;17|
             (72 . |factorial|) |PRTITION;pdct;$I;18|
             (|PositiveInteger|) (|SingleInteger|) (|String|))
          '#(~= 77 |zero?| 83 |subtractIfCan| 88 |sample| 94 |powers|
             98 |pdct| 103 |partition| 108 |min| 113 |max| 119 |latex|
             125 |hash| 130 |convert| 135 |conjugate| 140 |coerce| 145
             |Zero| 155 >= 159 > 165 = 171 <= 177 < 183 + 189 * 195)
          'NIL
          (CONS (|makeByteWordVec2| 1 '(0 0 0 0 0 0 0 0 0 0 0))
                (CONS '#(NIL NIL NIL NIL |AbelianMonoid&| |OrderedSet&|
                         |AbelianSemiGroup&| |SetCategory&| NIL
                         |BasicType&| NIL)
                      (CONS '#((|OrderedCancellationAbelianMonoid|)
                               (|OrderedAbelianMonoid|)
                               (|CancellationAbelianMonoid|)
                               (|OrderedAbelianSemiGroup|)
                               (|AbelianMonoid|) (|OrderedSet|)
                               (|AbelianSemiGroup|) (|SetCategory|)
                               (|ConvertibleTo| 8) (|BasicType|)
                               (|CoercibleTo| 32))
                            (|makeByteWordVec2| 47
                                '(1 8 0 0 10 2 13 12 0 0 14 2 6 0 15 0
                                  16 2 22 21 0 0 23 2 6 12 13 0 25 1 29
                                  8 8 30 1 13 32 0 33 2 32 0 0 0 34 1 6
                                  13 0 35 1 6 32 0 36 2 32 0 0 0 37 2
                                  39 32 38 0 40 1 32 0 0 41 1 13 0 0 43
                                  2 0 12 0 0 1 1 0 12 0 1 2 0 21 0 0 26
                                  0 0 0 1 1 0 27 8 28 1 0 13 0 44 1 0 0
                                  8 17 2 0 0 0 0 1 2 0 0 0 0 1 1 0 47 0
                                  1 1 0 46 0 1 1 0 8 0 11 1 0 0 0 31 1
                                  0 8 0 9 1 0 32 0 42 0 0 0 7 2 0 12 0
                                  0 1 2 0 12 0 0 1 2 0 12 0 0 19 2 0 12
                                  0 0 1 2 0 12 0 0 18 2 0 0 0 0 20 2 0
                                  0 22 0 24 2 0 0 45 0 1)))))
          '|lookupComplete|)) 

(MAKEPROP '|Partition| 'NILADIC T) 
