"use strict";

var fp = {
  curry,
  compose,
  pipe
};


function curry(fn) {
  return function(...args) {
    if(fn.length > args.length) {
      var arg = args;
      return function(...args) {return fn.apply(null, arg.concat(args));};
    }
    return fn.apply(null, args);
  };
}

function compose(f,g) {
  return function(...x) {return f(g(...x));}
}

function pipe(...fns) {
  return fns.reduce(compose);
}

