
(/VERSIONCHECK 2) 

(DEFPARAMETER |BagAggregate;CAT| 'NIL) 

(DEFPARAMETER |BagAggregate;AL| 'NIL) 

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

(DEFUN |BagAggregate;| (|t#1|)
  (PROG (#0=#:G1815)
    (RETURN
      (PROG1 (LETT #0#
                   (|sublisV|
                       (PAIR '(|t#1|) (LIST (|devaluate| |t#1|)))
                       (COND
                         (|BagAggregate;CAT|)
                         ('T
                          (LETT |BagAggregate;CAT|
                                (|Join| (|HomogeneousAggregate| '|t#1|)
                                        (|shallowlyMutable|)
                                        (|mkCategory| '|domain|
                                         '(((|bag| ($ (|List| |t#1|)))
                                            T)
                                           ((|extract!| (|t#1| $)) T)
                                           ((|insert!| ($ |t#1| $)) T)
                                           ((|inspect| (|t#1| $)) T))
                                         NIL '((|List| |t#1|)) NIL))
                                . #1=(|BagAggregate|))))) . #1#)
        (SETELT #0# 0 (LIST '|BagAggregate| (|devaluate| |t#1|))))))) 
