 
 (.add-facts kn "know" "clause-aggregate-vars" #js ["aggregate-id" "ix" "var"] #js [#js ["count-zz" 0 "zz"]])
 
-(.add-facts kn "know" "clause-aggregate-funs" #js ["aggregate-id" "js"] #js [#js ["count-zz" "cljs.core.count"]])
+(.add-facts kn "know" "clause-aggregate-funs" #js ["aggregate-id" "js"] #js [#js ["count-zz" "count"]])
 
 (def flows (compile kn))
 

                ;; create aggregate flow if needed
                (when-not (nil? aggregate-key)
                  (let [input-index (.get-or-create-index kn "know" output-name filtered-fields)
                        aggregate-function (js/eval aggregate-fun)
                        prefix-len (- (count final-fields) 1)]
                    (swap! name->transient? assoc output-name true)
                    (swap! kind->name->rules update-in ["know" output-name] #(conj (or % #{}) output-name))

                     (when (nil? current-key)
                       (set!! current-key key))
                     (when (btree/prefix-not= key current-key prefix-len)
                       (let [outputs (aggregate-function inputs)]
                         (dotimes [i (alength outputs)]
                           (let [output-key (.slice current-key 0 prefix-len)]
                             (aset output-key prefix-len (aget outputs i))
                             (apush output-facts&vals output-key)
                             (apush output-facts&vals 1)))
                         (set!! current-key key)
                         (aclear inputs)))
                     (apush inputs (.slice key prefix-len))))
         (when (> (alength inputs) 0)
           (let [outputs (aggregate-function inputs)]
             (dotimes [i (alength outputs)]
               (let [output-key (.slice current-key 0 prefix-len)]
                 (aset output-key prefix-len (aget outputs i))
                 (apush output-facts&vals output-key)
                 (apush output-facts&vals 1)))
             (set!! current-key key)
             (aclear inputs)))
         (when (true? (.update-facts kn output-kind output-name output-fields output-facts&vals))
