API for accumulators - clojure-contrib v1.2 (stable)

by Konrad Hinsen

Full namespace name: clojure.contrib.accumulators

Overview

A generic accumulator interface and implementations of various
accumulators.

Public Variables and Functions



add

multimethod
Usage: (add acc item)
Add item to the accumulator acc. The exact meaning of adding an
an item depends on the type of the accumulator.
Source


add-items

function
Usage: (add-items acc items)
Add all elements of a collection coll to the accumulator acc.
Source


combine

multimethod
Usage: (combine & accs)
Combine the values of the accumulators acc1 and acc2 into a
single accumulator of the same type.
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
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.