Skip to content
johnmcclean-aol edited this page Feb 24, 2016 · 3 revisions

Cyclops has merged with simple-react. Please update your bookmarks (stars :) ) to https://github.com/aol/cyclops-react

All new develpoment on cyclops occurs in cyclops-react. Older modules are still available in maven central.

screen shot 2016-02-22 at 8 44 42 pm

The Monoid Wrapper

com.aol.cyclops.lambda.api.Monoid is a generic interface that can define or wrap around a Monoid ( implementations are provided by libraries such as Functional Java or can be created via Monoid.of).

Wrapping (coercing) to Monoid

Monoids can be coerced to the generic Monoid interface via

  • AsMonoid.asMonoid
  • As.asMonoid

Monoid operations

com.aol.cyclops.lambda.api.Monoid provides

The monoid methods / functions

  • zero
  • combiner()

And

  • reduce : reduce a Stream - the method signature of Stream.reduce is a monoid
  • mapReduce : maps to appropriate type before reduction

Rationale

Provide a generic way to define and reuse Monoids in Java (principally for Stream Reduction).

Clone this wiki locally