0.2.0 • Published 11 years ago

reduced v0.2.0

Weekly downloads
4
License
-
Repository
github
Last release
11 years ago

reduced

Some notes:

  • pull-style lazy sequences
  • a set of combinators for them
  • modelled after clojure/reducers
  • plays well with arrays, promises and other monads (theoretically)
  • see specs for docs

Brief example:

{equal} = require 'assert'
{fold, take, repeat, reduced} = require 'reduced'

# compute a sum of a seq
sum = (seq) ->
  fold(seq, ((v, s) -> v + s), 0)

# sum of a hundred of 1s
sum100 = sum(take repeat(1), 100)

reduced(sum100).then (v) ->
  equal v, 100

reduced is a parametrized module (functor)

You can use reduced with other types of monads — there's makeModule function which created another instance of reduced module.

var reducedForStreams = reduced.makeModule(function(stream) {
  // make seq from a stream
});

That way reducedForStreams would have exactly the same function available as original reduce module but those functions will work only on streams.

0.2.0

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago