
(/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| (|i1| |i2| $)
  (SPADCALL |i2| |i1| (QREFELT $ 14))) 

(DEFUN |PRTITION;<;2$B;5| (|x| |y| $)
  (COND ((NULL |x|) (COND ((NULL |y|) 'NIL) (#1='T 'T))) ((NULL |y|) 'NIL)
        ((EQL (|SPADfirst| |x|) (|SPADfirst| |y|))
         (SPADCALL (CDR |x|) (CDR |y|) (QREFELT $ 18)))
        (#1# (< (|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 (#1=#:G702)
    (RETURN
     (COND ((ZEROP |n|) (|spadConstant| $ 7))
           ('T
            (SPADCALL |x|
                      (SPADCALL
                       (PROG2
                           (LETT #1# (SPADCALL |n| 1 (QREFELT $ 23))
                                 |PRTITION;*;Nni2$;8|)
                           (QCDR #1#)
                         (|check-union| (QEQCAR #1# 0) (|NonNegativeInteger|)
                                        #1#))
                       |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)))
              (#1='T (CONS 1 "failed"))))
       ((NULL |y|) (CONS 0 |x|))
       (#1#
        (SEQ
         (LETT |aa| (|PRTITION;remv| (|SPADfirst| |y|) |x| $)
               |PRTITION;subtractIfCan;2$U;11|)
         (EXIT
          (COND ((QEQCAR |aa| 1) (CONS 1 "failed"))
                (#1# (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 (#1=#:G740 #2=#:G739 #3=#:G741 #4=#:G743 |a|)
    (RETURN
     (SEQ
      (PROGN
       (LETT #1# NIL . #5=(|PRTITION;pdct;$I;18|))
       (SEQ (LETT |a| NIL . #5#) (LETT #4# (SPADCALL |x| (QREFELT $ 28)) . #5#)
            G190
            (COND
             ((OR (ATOM #4#) (PROGN (LETT |a| (CAR #4#) . #5#) NIL))
              (GO G191)))
            (SEQ
             (EXIT
              (PROGN
               (LETT #3#
                     (* (SPADCALL (SPADCALL |a| (QREFELT $ 35)) (QREFELT $ 43))
                        (EXPT (|SPADfirst| |a|) (SPADCALL |a| (QREFELT $ 35))))
                     . #5#)
               (COND (#1# (LETT #2# (* #2# #3#) . #5#))
                     ('T (PROGN (LETT #2# #3# . #5#) (LETT #1# 'T . #5#)))))))
            (LETT #4# (CDR #4#) . #5#) (GO G190) G191 (EXIT NIL))
       (COND (#1# #2#) ('T 1))))))) 

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

(DEFUN |Partition;| ()
  (PROG (|dv$| $ |pv$|)
    (RETURN
     (PROGN
      (LETT |dv$| '(|Partition|) . #1=(|Partition|))
      (LETT $ (GETREFV 48) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|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|) (|String|) (|SingleInteger|))
           '#(~= 77 |zero?| 83 |subtractIfCan| 88 |smaller?| 94 |sample| 100
              |powers| 104 |pdct| 109 |partition| 114 |min| 119 |max| 125
              |latex| 131 |hash| 136 |convert| 141 |conjugate| 146 |coerce| 151
              |Zero| 161 >= 165 > 171 = 177 <= 183 < 189 + 195 * 201)
           'NIL
           (CONS (|makeByteWordVec2| 1 '(0 0 0 0 0 0 0 0 0 0 0 0))
                 (CONS
                  '#(NIL NIL NIL NIL |OrderedSet&| |AbelianMonoid&| NIL
                     |AbelianSemiGroup&| |SetCategory&| NIL |BasicType&| NIL)
                  (CONS
                   '#((|OrderedCancellationAbelianMonoid|)
                      (|OrderedAbelianMonoid|) (|OrderedAbelianSemiGroup|)
                      (|CancellationAbelianMonoid|) (|OrderedSet|)
                      (|AbelianMonoid|) (|Comparable|) (|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 2 0
                                         12 0 0 1 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 46 0 1 1 0 47 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) 
