API for accumulators
- ()
by Konrad Hinsen
Usage:
(ns your-namespace
(:require clojure.contrib.accumulators))
Overview
A generic accumulator interface and implementations of various
accumulators.
Public Variables and Functions
add-items
function
Usage: (add-items acc items)
Add all elements of a collection coll to the accumulator acc.
Source
empty-counter
var
An empty counter accumulator. Its value is a map that stores for
every item the number of times it was added.
Source
empty-counter-with-total
var
An empty counter-with-total accumulator. It works like the counter
accumulator, except that the total number of items added is stored as the
value of the key :total.
Source
empty-list
var
An empty list accumulator. Adding an item appends it at the beginning.
Source
empty-map
var
An empty map accumulator. Items to be added must be [key value] pairs.
Source
empty-maximum
var
An empty maximum accumulator. Only numbers can be added.
Source
empty-mean-variance
var
An empty mean-variance accumulator, combining sample mean and
sample variance. Only numbers can be added.
Source
empty-min-max
var
An empty min-max accumulator, combining minimum and maximum.
Only numbers can be added.
Source
empty-minimum
var
An empty minimum accumulator. Only numbers can be added.
Source
empty-product
var
An empty sum accumulator. Only numbers can be added.
Source
empty-queue
var
An empty queue accumulator. Adding an item appends it at the end.
Source
empty-set
var
An empty set accumulator.
Source
empty-string
var
An empty string accumulator. Adding an item (string or character)
appends it at the end.
Source
empty-sum
var
An empty sum accumulator. Only numbers can be added.
Source
empty-tuple
function
Usage: (empty-tuple empty-accumulators)
Returns an accumulator tuple with the supplied empty-accumulators
as its value. Accumulator tuples consist of several accumulators that
work in parallel. Added items must be sequences whose number of elements
matches the number of sub-accumulators.
Source
empty-vector
var
An empty vector accumulator. Adding an item appends it at the end.
Source