Skip to content

Commit

Permalink
do a gcd example with zipWith + show new $ function
Browse files Browse the repository at this point in the history
  • Loading branch information
clux committed Nov 11, 2012
1 parent 16d1b2f commit 7b9cec3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Expand Up @@ -17,6 +17,9 @@ and get functional:
$.id(x) === x;
$.noop(x) === undefined;

var fn = $(fn1, fn2, fn3);
fn(a); // fn3(fn2(fn1(a)))

[1,3,2].map($.constant(5)); // [5, 5, 5]

[1,2,3,4,3].filter($.elem([1,3])); // [ 1, 3, 3 ]
Expand All @@ -30,7 +33,7 @@ $.gcd(10, 15); // 5
$.range(5); // [ 1, 2, 3, 4, 5 ]

$.zip($.range(5), [1,2], [3,2,5]); // [ [ 1, 1, 3 ], [ 2, 2, 2 ] ]
$.zipWith(op.plus2, [1,1,1], $.range(5)); // [ 2, 3, 4 ]
$.zipWith($.gcd, [5, 10, 15], $.range(5)); // [ 1, 2, 3 ]

$.iterate(3, "ha!", function (str) {
return "ha" + str
Expand All @@ -41,7 +44,7 @@ $.iterate(3, "ha!", function (str) {

Read the read the [API](https://github.com/clux/autonomy/blob/master/api.md).

In most cases the [operators](https://github.com/clux/operators) module provides some must have additions to autonomy. It's referenced once above as `op`, and you can just do `$.extend($, require('operators'))` to import all the helpers onto autonomy's object.
In most cases the [operators](https://github.com/clux/operators) module provides some almost must have additions to autonomy. You can just do `$.extend($, require('operators'))` to import all the helpers onto autonomy's object.

*This modules makes up the core part of the larger utility library*: [interlude](https://github.com/clux/interlude). If you find yourself extending with `operators` or `subset` a lot, you should use `interlude` instead (there's also more documentation included there).

Expand Down

0 comments on commit 7b9cec3

Please sign in to comment.