
(/VERSIONCHECK 2) 

(DEFPARAMETER |OrderedMultisetAggregate;CAT| 'NIL) 

(DEFPARAMETER |OrderedMultisetAggregate;AL| 'NIL) 

(DEFUN |OrderedMultisetAggregate| (#0=#:G1816)
  (LET (#1=#:G1817)
    (COND
      ((SETQ #1#
             (|assoc| #2=(|devaluate| #0#)
                      |OrderedMultisetAggregate;AL|))
       (CDR #1#))
      (T (SETQ |OrderedMultisetAggregate;AL|
               (|cons5| (CONS #2#
                              (SETQ #1#
                                    (|OrderedMultisetAggregate;| #0#)))
                        |OrderedMultisetAggregate;AL|))
         #1#)))) 

(DEFUN |OrderedMultisetAggregate;| (|t#1|)
  (PROG (#0=#:G1815)
    (RETURN
      (PROG1 (LETT #0#
                   (|sublisV|
                       (PAIR '(|t#1|) (LIST (|devaluate| |t#1|)))
                       (COND
                         (|OrderedMultisetAggregate;CAT|)
                         ('T
                          (LETT |OrderedMultisetAggregate;CAT|
                                (|Join| (|MultisetAggregate| '|t#1|)
                                        (|PriorityQueueAggregate|
                                         '|t#1|)
                                        (|mkCategory| '|domain|
                                         '(((|min| (|t#1| $)) T)) NIL
                                         'NIL NIL))
                                . #1=(|OrderedMultisetAggregate|))))) . #1#)
        (SETELT #0# 0
                (LIST '|OrderedMultisetAggregate| (|devaluate| |t#1|))))))) 
