Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

composition: remove S.meld #280

Merged
merged 1 commit into from
Nov 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,6 @@
//. In general terms, `pipe` performs left-to-right composition of an array
//. of functions. `pipe([f, g, h], x)` is equivalent to `h(g(f(x)))`.
//.
//. See also [`meld`](#meld).
//.
//. ```javascript
//. > S.pipe([S.inc, Math.sqrt, S.dec])(99)
//. 9
Expand All @@ -761,48 +759,6 @@
}
S.pipe = def('pipe', {}, [$.Array($.Function), a, b], pipe);

//# meld :: [** -> *] -> (* -> * -> ... -> *)
//.
//. Takes an array of non-nullary functions and returns a curried function
//. whose arity is one greater than the sum of the arities of the given
//. functions less the number of functions.
//.
//. The behaviour of `meld` is best conveyed diagrammatically. The following
//. diagram depicts the "melding" of binary functions `f` and `g`:
//.
//. +-------+
//. --- a --->| |
//. | f | +-------+
//. --- b --->| |--- f(a, b) --->| |
//. +-------+ | g |
//. --- c ---------------------------->| |--- g(f(a, b), c) --->
//. +-------+
//.
//. See also [`pipe`](#pipe).
//.
//. ```javascript
//. > S.meld([Math.pow, S.sub])(3, 4, 5)
//. 76
//.
//. > S.meld([Math.pow, S.sub])(3)(4)(5)
//. 76
//. ```
function meld(fs) {
return R.curryN(
fs.reduce(function(n, f) { return n + f.length - 1; }, 1),
function() {
return fs.reduce(
function(args, f) {
var idx = f.length;
return prepend(f.apply(null, args.slice(0, idx)), args.slice(idx));
},
_slice.call(arguments)
)[0];
}
);
}
S.meld = def('meld', {}, [$.Array($.Function), $.Function], meld);

//. ### Maybe type
//.
//. The Maybe type represents optional values: a value of type `Maybe a` is
Expand Down
62 changes: 0 additions & 62 deletions test/meld.js

This file was deleted.