Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * @NApiVersion 2.x
  3.  *
  4.  * @NModuleScope Public
  5.  */
  6. define([],
  7.        
  8. function() {
  9. //  Ramda v0.23.0
  10. //  https://github.com/ramda/ramda
  11. //  (c) 2013-2016 Scott Sauyet, Michael Hurley, and David Chambers
  12. //  Ramda may be freely distributed under the MIT license.
  13.  
  14.  
  15.   'use strict';
  16.  
  17.   /**
  18.      * A special placeholder value used to specify "gaps" within curried functions,
  19.      * allowing partial application of any combination of arguments, regardless of
  20.      * their positions.
  21.      *
  22.      * If `g` is a curried ternary function and `_` is `R.__`, the following are
  23.      * equivalent:
  24.      *
  25.      *   - `g(1, 2, 3)`
  26.      *   - `g(_, 2, 3)(1)`
  27.      *   - `g(_, _, 3)(1)(2)`
  28.      *   - `g(_, _, 3)(1, 2)`
  29.      *   - `g(_, 2, _)(1, 3)`
  30.      *   - `g(_, 2)(1)(3)`
  31.      *   - `g(_, 2)(1, 3)`
  32.      *   - `g(_, 2)(_, 3)(1)`
  33.      *
  34.      * @constant
  35.      * @memberOf R
  36.      * @since v0.6.0
  37.      * @category Function
  38.      * @example
  39.      *
  40.      *      var greet = R.replace('{name}', R.__, 'Hello, {name}!');
  41.      *      greet('Alice'); //=> 'Hello, Alice!'
  42.      */
  43.     var __ = { '@@functional/placeholder': true };
  44.  
  45.     var _aperture = function _aperture(n, list) {
  46.         var idx = 0;
  47.         var limit = list.length - (n - 1);
  48.         var acc = new Array(limit >= 0 ? limit : 0);
  49.         while (idx < limit) {
  50.             acc[idx] = Array.prototype.slice.call(list, idx, idx + n);
  51.             idx += 1;
  52.         }
  53.         return acc;
  54.     };
  55.  
  56.     /* eslint-disable no-unused-vars */
  57.     var _arity = function _arity(n, fn) {
  58.         /* eslint-disable no-unused-vars */
  59.         switch (n) {
  60.         case 0:
  61.             return function () {
  62.                 return fn.apply(this, arguments);
  63.             };
  64.         case 1:
  65.             return function (a0) {
  66.                 return fn.apply(this, arguments);
  67.             };
  68.         case 2:
  69.             return function (a0, a1) {
  70.                 return fn.apply(this, arguments);
  71.             };
  72.         case 3:
  73.             return function (a0, a1, a2) {
  74.                 return fn.apply(this, arguments);
  75.             };
  76.         case 4:
  77.             return function (a0, a1, a2, a3) {
  78.                 return fn.apply(this, arguments);
  79.             };
  80.         case 5:
  81.             return function (a0, a1, a2, a3, a4) {
  82.                 return fn.apply(this, arguments);
  83.             };
  84.         case 6:
  85.             return function (a0, a1, a2, a3, a4, a5) {
  86.                 return fn.apply(this, arguments);
  87.             };
  88.         case 7:
  89.             return function (a0, a1, a2, a3, a4, a5, a6) {
  90.                 return fn.apply(this, arguments);
  91.             };
  92.         case 8:
  93.             return function (a0, a1, a2, a3, a4, a5, a6, a7) {
  94.                 return fn.apply(this, arguments);
  95.             };
  96.         case 9:
  97.             return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) {
  98.                 return fn.apply(this, arguments);
  99.             };
  100.         case 10:
  101.             return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
  102.                 return fn.apply(this, arguments);
  103.             };
  104.         default:
  105.             throw new Error('First argument to _arity must be a non-negative integer no greater than ten');
  106.         }
  107.     };
  108.  
  109.     var _arrayFromIterator = function _arrayFromIterator(iter) {
  110.         var list = [];
  111.         var next;
  112.         while (!(next = iter.next()).done) {
  113.             list.push(next.value);
  114.         }
  115.         return list;
  116.     };
  117.  
  118.     var _cloneRegExp = function _cloneRegExp(pattern) {
  119.         return new RegExp(pattern.source, (pattern.global ? 'g' : '') + (pattern.ignoreCase ? 'i' : '') + (pattern.multiline ? 'm' : '') + (pattern.sticky ? 'y' : '') + (pattern.unicode ? 'u' : ''));
  120.     };
  121.  
  122.     var _complement = function _complement(f) {
  123.         return function () {
  124.             return !f.apply(this, arguments);
  125.         };
  126.     };
  127.  
  128.     /**
  129.      * Private `concat` function to merge two array-like objects.
  130.      *
  131.      * @private
  132.      * @param {Array|Arguments} [set1=[]] An array-like object.
  133.      * @param {Array|Arguments} [set2=[]] An array-like object.
  134.      * @return {Array} A new, merged array.
  135.      * @example
  136.      *
  137.      *      _concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3]
  138.      */
  139.     var _concat = function _concat(set1, set2) {
  140.         set1 = set1 || [];
  141.         set2 = set2 || [];
  142.         var idx;
  143.         var len1 = set1.length;
  144.         var len2 = set2.length;
  145.         var result = [];
  146.         idx = 0;
  147.         while (idx < len1) {
  148.             result[result.length] = set1[idx];
  149.             idx += 1;
  150.         }
  151.         idx = 0;
  152.         while (idx < len2) {
  153.             result[result.length] = set2[idx];
  154.             idx += 1;
  155.         }
  156.         return result;
  157.     };
  158.  
  159.     var _containsWith = function _containsWith(pred, x, list) {
  160.         var idx = 0;
  161.         var len = list.length;
  162.         while (idx < len) {
  163.             if (pred(x, list[idx])) {
  164.                 return true;
  165.             }
  166.             idx += 1;
  167.         }
  168.         return false;
  169.     };
  170.  
  171.     var _dropLastWhile = function dropLastWhile(pred, list) {
  172.         var idx = list.length - 1;
  173.         while (idx >= 0 && pred(list[idx])) {
  174.             idx -= 1;
  175.         }
  176.         return Array.prototype.slice.call(list, 0, idx + 1);
  177.     };
  178.  
  179.     var _filter = function _filter(fn, list) {
  180.         var idx = 0;
  181.         var len = list.length;
  182.         var result = [];
  183.         while (idx < len) {
  184.             if (fn(list[idx])) {
  185.                 result[result.length] = list[idx];
  186.             }
  187.             idx += 1;
  188.         }
  189.         return result;
  190.     };
  191.  
  192.     var _forceReduced = function _forceReduced(x) {
  193.         return {
  194.             '@@transducer/value': x,
  195.             '@@transducer/reduced': true
  196.         };
  197.     };
  198.  
  199.     // String(x => x) evaluates to "x => x", so the pattern may not match.
  200.     var _functionName = function _functionName(f) {
  201.         // String(x => x) evaluates to "x => x", so the pattern may not match.
  202.         var match = String(f).match(/^function (\w*)/);
  203.         return match == null ? '' : match[1];
  204.     };
  205.  
  206.     var _has = function _has(prop, obj) {
  207.         return Object.prototype.hasOwnProperty.call(obj, prop);
  208.     };
  209.  
  210.     var _identity = function _identity(x) {
  211.         return x;
  212.     };
  213.  
  214.     var _isArguments = function () {
  215.         var toString = Object.prototype.toString;
  216.         return toString.call(arguments) === '[object Arguments]' ? function _isArguments(x) {
  217.             return toString.call(x) === '[object Arguments]';
  218.         } : function _isArguments(x) {
  219.             return _has('callee', x);
  220.         };
  221.     }();
  222.  
  223.     /**
  224.      * Tests whether or not an object is an array.
  225.      *
  226.      * @private
  227.      * @param {*} val The object to test.
  228.      * @return {Boolean} `true` if `val` is an array, `false` otherwise.
  229.      * @example
  230.      *
  231.      *      _isArray([]); //=> true
  232.      *      _isArray(null); //=> false
  233.      *      _isArray({}); //=> false
  234.      */
  235.     var _isArray = Array.isArray || function _isArray(val) {
  236.         return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]';
  237.     };
  238.  
  239.     var _isFunction = function _isFunction(x) {
  240.         return Object.prototype.toString.call(x) === '[object Function]';
  241.     };
  242.  
  243.     /**
  244.      * Determine if the passed argument is an integer.
  245.      *
  246.      * @private
  247.      * @param {*} n
  248.      * @category Type
  249.      * @return {Boolean}
  250.      */
  251.     var _isInteger = Number.isInteger || function _isInteger(n) {
  252.         return n << 0 === n;
  253.     };
  254.  
  255.     var _isNumber = function _isNumber(x) {
  256.         return Object.prototype.toString.call(x) === '[object Number]';
  257.     };
  258.  
  259.     var _isObject = function _isObject(x) {
  260.         return Object.prototype.toString.call(x) === '[object Object]';
  261.     };
  262.  
  263.     var _isPlaceholder = function _isPlaceholder(a) {
  264.         return a != null && typeof a === 'object' && a['@@functional/placeholder'] === true;
  265.     };
  266.  
  267.     var _isRegExp = function _isRegExp(x) {
  268.         return Object.prototype.toString.call(x) === '[object RegExp]';
  269.     };
  270.  
  271.     var _isString = function _isString(x) {
  272.         return Object.prototype.toString.call(x) === '[object String]';
  273.     };
  274.  
  275.     var _isTransformer = function _isTransformer(obj) {
  276.         return typeof obj['@@transducer/step'] === 'function';
  277.     };
  278.  
  279.     var _map = function _map(fn, functor) {
  280.         var idx = 0;
  281.         var len = functor.length;
  282.         var result = Array(len);
  283.         while (idx < len) {
  284.             result[idx] = fn(functor[idx]);
  285.             idx += 1;
  286.         }
  287.         return result;
  288.     };
  289.  
  290.     // Based on https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
  291.     var _objectAssign = function _objectAssign(target) {
  292.         if (target == null) {
  293.             throw new TypeError('Cannot convert undefined or null to object');
  294.         }
  295.         var output = Object(target);
  296.         var idx = 1;
  297.         var length = arguments.length;
  298.         while (idx < length) {
  299.             var source = arguments[idx];
  300.             if (source != null) {
  301.                 for (var nextKey in source) {
  302.                     if (_has(nextKey, source)) {
  303.                         output[nextKey] = source[nextKey];
  304.                     }
  305.                 }
  306.             }
  307.             idx += 1;
  308.         }
  309.         return output;
  310.     };
  311.  
  312.     var _of = function _of(x) {
  313.         return [x];
  314.     };
  315.  
  316.     var _pipe = function _pipe(f, g) {
  317.         return function () {
  318.             return g.call(this, f.apply(this, arguments));
  319.         };
  320.     };
  321.  
  322.     var _pipeP = function _pipeP(f, g) {
  323.         return function () {
  324.             var ctx = this;
  325.             return f.apply(ctx, arguments).then(function (x) {
  326.                 return g.call(ctx, x);
  327.             });
  328.         };
  329.     };
  330.  
  331.     // \b matches word boundary; [\b] matches backspace
  332.     var _quote = function _quote(s) {
  333.         var escaped = s.replace(/\\/g, '\\\\').replace(/[\b]/g, '\\b')    // \b matches word boundary; [\b] matches backspace
  334.     .replace(/\f/g, '\\f').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\t/g, '\\t').replace(/\v/g, '\\v').replace(/\0/g, '\\0');
  335.         return '"' + escaped.replace(/"/g, '\\"') + '"';
  336.     };
  337.  
  338.     var _reduced = function _reduced(x) {
  339.         return x && x['@@transducer/reduced'] ? x : {
  340.             '@@transducer/value': x,
  341.             '@@transducer/reduced': true
  342.         };
  343.     };
  344.  
  345.     /**
  346.      * Polyfill from <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString>.
  347.      */
  348.     var _toISOString = function () {
  349.         var pad = function pad(n) {
  350.             return (n < 10 ? '0' : '') + n;
  351.         };
  352.         return typeof Date.prototype.toISOString === 'function' ? function _toISOString(d) {
  353.             return d.toISOString();
  354.         } : function _toISOString(d) {
  355.             return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate()) + 'T' + pad(d.getUTCHours()) + ':' + pad(d.getUTCMinutes()) + ':' + pad(d.getUTCSeconds()) + '.' + (d.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z';
  356.         };
  357.     }();
  358.  
  359.     var _xfBase = {
  360.         init: function () {
  361.             return this.xf['@@transducer/init']();
  362.         },
  363.         result: function (result) {
  364.             return this.xf['@@transducer/result'](result);
  365.         }
  366.     };
  367.  
  368.     var _xwrap = function () {
  369.         function XWrap(fn) {
  370.             this.f = fn;
  371.         }
  372.         XWrap.prototype['@@transducer/init'] = function () {
  373.             throw new Error('init not implemented on XWrap');
  374.         };
  375.         XWrap.prototype['@@transducer/result'] = function (acc) {
  376.             return acc;
  377.         };
  378.         XWrap.prototype['@@transducer/step'] = function (acc, x) {
  379.             return this.f(acc, x);
  380.         };
  381.         return function _xwrap(fn) {
  382.             return new XWrap(fn);
  383.         };
  384.     }();
  385.  
  386.     var _assign = typeof Object.assign === 'function' ? Object.assign : _objectAssign;
  387.  
  388.     /**
  389.      * This checks whether a function has a [methodname] function. If it isn't an
  390.      * array it will execute that function otherwise it will default to the ramda
  391.      * implementation.
  392.      *
  393.      * @private
  394.      * @param {Function} fn ramda implemtation
  395.      * @param {String} methodname property to check for a custom implementation
  396.      * @return {Object} Whatever the return value of the method is.
  397.      */
  398.     var _checkForMethod = function _checkForMethod(methodname, fn) {
  399.         return function () {
  400.             var length = arguments.length;
  401.             if (length === 0) {
  402.                 return fn();
  403.             }
  404.             var obj = arguments[length - 1];
  405.             return _isArray(obj) || typeof obj[methodname] !== 'function' ? fn.apply(this, arguments) : obj[methodname].apply(obj, Array.prototype.slice.call(arguments, 0, length - 1));
  406.         };
  407.     };
  408.  
  409.     /**
  410.      * Optimized internal one-arity curry function.
  411.      *
  412.      * @private
  413.      * @category Function
  414.      * @param {Function} fn The function to curry.
  415.      * @return {Function} The curried function.
  416.      */
  417.     var _curry1 = function _curry1(fn) {
  418.         return function f1(a) {
  419.             if (arguments.length === 0 || _isPlaceholder(a)) {
  420.                 return f1;
  421.             } else {
  422.                 return fn.apply(this, arguments);
  423.             }
  424.         };
  425.     };
  426.  
  427.     /**
  428.      * Optimized internal two-arity curry function.
  429.      *
  430.      * @private
  431.      * @category Function
  432.      * @param {Function} fn The function to curry.
  433.      * @return {Function} The curried function.
  434.      */
  435.     var _curry2 = function _curry2(fn) {
  436.         return function f2(a, b) {
  437.             switch (arguments.length) {
  438.             case 0:
  439.                 return f2;
  440.             case 1:
  441.                 return _isPlaceholder(a) ? f2 : _curry1(function (_b) {
  442.                     return fn(a, _b);
  443.                 });
  444.             default:
  445.                 return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) {
  446.                     return fn(_a, b);
  447.                 }) : _isPlaceholder(b) ? _curry1(function (_b) {
  448.                     return fn(a, _b);
  449.                 }) : fn(a, b);
  450.             }
  451.         };
  452.     };
  453.  
  454.     /**
  455.      * Optimized internal three-arity curry function.
  456.      *
  457.      * @private
  458.      * @category Function
  459.      * @param {Function} fn The function to curry.
  460.      * @return {Function} The curried function.
  461.      */
  462.     var _curry3 = function _curry3(fn) {
  463.         return function f3(a, b, c) {
  464.             switch (arguments.length) {
  465.             case 0:
  466.                 return f3;
  467.             case 1:
  468.                 return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) {
  469.                     return fn(a, _b, _c);
  470.                 });
  471.             case 2:
  472.                 return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) {
  473.                     return fn(_a, b, _c);
  474.                 }) : _isPlaceholder(b) ? _curry2(function (_b, _c) {
  475.                     return fn(a, _b, _c);
  476.                 }) : _curry1(function (_c) {
  477.                     return fn(a, b, _c);
  478.                 });
  479.             default:
  480.                 return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) {
  481.                     return fn(_a, _b, c);
  482.                 }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function (_a, _c) {
  483.                     return fn(_a, b, _c);
  484.                 }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function (_b, _c) {
  485.                     return fn(a, _b, _c);
  486.                 }) : _isPlaceholder(a) ? _curry1(function (_a) {
  487.                     return fn(_a, b, c);
  488.                 }) : _isPlaceholder(b) ? _curry1(function (_b) {
  489.                     return fn(a, _b, c);
  490.                 }) : _isPlaceholder(c) ? _curry1(function (_c) {
  491.                     return fn(a, b, _c);
  492.                 }) : fn(a, b, c);
  493.             }
  494.         };
  495.     };
  496.  
  497.     /**
  498.      * Internal curryN function.
  499.      *
  500.      * @private
  501.      * @category Function
  502.      * @param {Number} length The arity of the curried function.
  503.      * @param {Array} received An array of arguments received thus far.
  504.      * @param {Function} fn The function to curry.
  505.      * @return {Function} The curried function.
  506.      */
  507.     var _curryN = function _curryN(length, received, fn) {
  508.         return function () {
  509.             var combined = [];
  510.             var argsIdx = 0;
  511.             var left = length;
  512.             var combinedIdx = 0;
  513.             while (combinedIdx < received.length || argsIdx < arguments.length) {
  514.                 var result;
  515.                 if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) {
  516.                     result = received[combinedIdx];
  517.                 } else {
  518.                     result = arguments[argsIdx];
  519.                     argsIdx += 1;
  520.                 }
  521.                 combined[combinedIdx] = result;
  522.                 if (!_isPlaceholder(result)) {
  523.                     left -= 1;
  524.                 }
  525.                 combinedIdx += 1;
  526.             }
  527.             return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn));
  528.         };
  529.     };
  530.  
  531.     /**
  532.      * Returns a function that dispatches with different strategies based on the
  533.      * object in list position (last argument). If it is an array, executes [fn].
  534.      * Otherwise, if it has a function with one of the given method names, it will
  535.      * execute that function (functor case). Otherwise, if it is a transformer,
  536.      * uses transducer [xf] to return a new transformer (transducer case).
  537.      * Otherwise, it will default to executing [fn].
  538.      *
  539.      * @private
  540.      * @param {Array} methodNames properties to check for a custom implementation
  541.      * @param {Function} xf transducer to initialize if object is transformer
  542.      * @param {Function} fn default ramda implementation
  543.      * @return {Function} A function that dispatches on object in list position
  544.      */
  545.     var _dispatchable = function _dispatchable(methodNames, xf, fn) {
  546.         return function () {
  547.             if (arguments.length === 0) {
  548.                 return fn();
  549.             }
  550.             var args = Array.prototype.slice.call(arguments, 0);
  551.             var obj = args.pop();
  552.             if (!_isArray(obj)) {
  553.                 var idx = 0;
  554.                 while (idx < methodNames.length) {
  555.                     if (typeof obj[methodNames[idx]] === 'function') {
  556.                         return obj[methodNames[idx]].apply(obj, args);
  557.                     }
  558.                     idx += 1;
  559.                 }
  560.                 if (_isTransformer(obj)) {
  561.                     var transducer = xf.apply(null, args);
  562.                     return transducer(obj);
  563.                 }
  564.             }
  565.             return fn.apply(this, arguments);
  566.         };
  567.     };
  568.  
  569.     var _xall = function () {
  570.         function XAll(f, xf) {
  571.             this.xf = xf;
  572.             this.f = f;
  573.             this.all = true;
  574.         }
  575.         XAll.prototype['@@transducer/init'] = _xfBase.init;
  576.         XAll.prototype['@@transducer/result'] = function (result) {
  577.             if (this.all) {
  578.                 result = this.xf['@@transducer/step'](result, true);
  579.             }
  580.             return this.xf['@@transducer/result'](result);
  581.         };
  582.         XAll.prototype['@@transducer/step'] = function (result, input) {
  583.             if (!this.f(input)) {
  584.                 this.all = false;
  585.                 result = _reduced(this.xf['@@transducer/step'](result, false));
  586.             }
  587.             return result;
  588.         };
  589.         return _curry2(function _xall(f, xf) {
  590.             return new XAll(f, xf);
  591.         });
  592.     }();
  593.  
  594.     var _xany = function () {
  595.         function XAny(f, xf) {
  596.             this.xf = xf;
  597.             this.f = f;
  598.             this.any = false;
  599.         }
  600.         XAny.prototype['@@transducer/init'] = _xfBase.init;
  601.         XAny.prototype['@@transducer/result'] = function (result) {
  602.             if (!this.any) {
  603.                 result = this.xf['@@transducer/step'](result, false);
  604.             }
  605.             return this.xf['@@transducer/result'](result);
  606.         };
  607.         XAny.prototype['@@transducer/step'] = function (result, input) {
  608.             if (this.f(input)) {
  609.                 this.any = true;
  610.                 result = _reduced(this.xf['@@transducer/step'](result, true));
  611.             }
  612.             return result;
  613.         };
  614.         return _curry2(function _xany(f, xf) {
  615.             return new XAny(f, xf);
  616.         });
  617.     }();
  618.  
  619.     var _xaperture = function () {
  620.         function XAperture(n, xf) {
  621.             this.xf = xf;
  622.             this.pos = 0;
  623.             this.full = false;
  624.             this.acc = new Array(n);
  625.         }
  626.         XAperture.prototype['@@transducer/init'] = _xfBase.init;
  627.         XAperture.prototype['@@transducer/result'] = function (result) {
  628.             this.acc = null;
  629.             return this.xf['@@transducer/result'](result);
  630.         };
  631.         XAperture.prototype['@@transducer/step'] = function (result, input) {
  632.             this.store(input);
  633.             return this.full ? this.xf['@@transducer/step'](result, this.getCopy()) : result;
  634.         };
  635.         XAperture.prototype.store = function (input) {
  636.             this.acc[this.pos] = input;
  637.             this.pos += 1;
  638.             if (this.pos === this.acc.length) {
  639.                 this.pos = 0;
  640.                 this.full = true;
  641.             }
  642.         };
  643.         XAperture.prototype.getCopy = function () {
  644.             return _concat(Array.prototype.slice.call(this.acc, this.pos), Array.prototype.slice.call(this.acc, 0, this.pos));
  645.         };
  646.         return _curry2(function _xaperture(n, xf) {
  647.             return new XAperture(n, xf);
  648.         });
  649.     }();
  650.  
  651.     var _xdrop = function () {
  652.         function XDrop(n, xf) {
  653.             this.xf = xf;
  654.             this.n = n;
  655.         }
  656.         XDrop.prototype['@@transducer/init'] = _xfBase.init;
  657.         XDrop.prototype['@@transducer/result'] = _xfBase.result;
  658.         XDrop.prototype['@@transducer/step'] = function (result, input) {
  659.             if (this.n > 0) {
  660.                 this.n -= 1;
  661.                 return result;
  662.             }
  663.             return this.xf['@@transducer/step'](result, input);
  664.         };
  665.         return _curry2(function _xdrop(n, xf) {
  666.             return new XDrop(n, xf);
  667.         });
  668.     }();
  669.  
  670.     var _xdropLast = function () {
  671.         function XDropLast(n, xf) {
  672.             this.xf = xf;
  673.             this.pos = 0;
  674.             this.full = false;
  675.             this.acc = new Array(n);
  676.         }
  677.         XDropLast.prototype['@@transducer/init'] = _xfBase.init;
  678.         XDropLast.prototype['@@transducer/result'] = function (result) {
  679.             this.acc = null;
  680.             return this.xf['@@transducer/result'](result);
  681.         };
  682.         XDropLast.prototype['@@transducer/step'] = function (result, input) {
  683.             if (this.full) {
  684.                 result = this.xf['@@transducer/step'](result, this.acc[this.pos]);
  685.             }
  686.             this.store(input);
  687.             return result;
  688.         };
  689.         XDropLast.prototype.store = function (input) {
  690.             this.acc[this.pos] = input;
  691.             this.pos += 1;
  692.             if (this.pos === this.acc.length) {
  693.                 this.pos = 0;
  694.                 this.full = true;
  695.             }
  696.         };
  697.         return _curry2(function _xdropLast(n, xf) {
  698.             return new XDropLast(n, xf);
  699.         });
  700.     }();
  701.  
  702.     var _xdropRepeatsWith = function () {
  703.         function XDropRepeatsWith(pred, xf) {
  704.             this.xf = xf;
  705.             this.pred = pred;
  706.             this.lastValue = undefined;
  707.             this.seenFirstValue = false;
  708.         }
  709.         XDropRepeatsWith.prototype['@@transducer/init'] = _xfBase.init;
  710.         XDropRepeatsWith.prototype['@@transducer/result'] = _xfBase.result;
  711.         XDropRepeatsWith.prototype['@@transducer/step'] = function (result, input) {
  712.             var sameAsLast = false;
  713.             if (!this.seenFirstValue) {
  714.                 this.seenFirstValue = true;
  715.             } else if (this.pred(this.lastValue, input)) {
  716.                 sameAsLast = true;
  717.             }
  718.             this.lastValue = input;
  719.             return sameAsLast ? result : this.xf['@@transducer/step'](result, input);
  720.         };
  721.         return _curry2(function _xdropRepeatsWith(pred, xf) {
  722.             return new XDropRepeatsWith(pred, xf);
  723.         });
  724.     }();
  725.  
  726.     var _xdropWhile = function () {
  727.         function XDropWhile(f, xf) {
  728.             this.xf = xf;
  729.             this.f = f;
  730.         }
  731.         XDropWhile.prototype['@@transducer/init'] = _xfBase.init;
  732.         XDropWhile.prototype['@@transducer/result'] = _xfBase.result;
  733.         XDropWhile.prototype['@@transducer/step'] = function (result, input) {
  734.             if (this.f) {
  735.                 if (this.f(input)) {
  736.                     return result;
  737.                 }
  738.                 this.f = null;
  739.             }
  740.             return this.xf['@@transducer/step'](result, input);
  741.         };
  742.         return _curry2(function _xdropWhile(f, xf) {
  743.             return new XDropWhile(f, xf);
  744.         });
  745.     }();
  746.  
  747.     var _xfilter = function () {
  748.         function XFilter(f, xf) {
  749.             this.xf = xf;
  750.             this.f = f;
  751.         }
  752.         XFilter.prototype['@@transducer/init'] = _xfBase.init;
  753.         XFilter.prototype['@@transducer/result'] = _xfBase.result;
  754.         XFilter.prototype['@@transducer/step'] = function (result, input) {
  755.             return this.f(input) ? this.xf['@@transducer/step'](result, input) : result;
  756.         };
  757.         return _curry2(function _xfilter(f, xf) {
  758.             return new XFilter(f, xf);
  759.         });
  760.     }();
  761.  
  762.     var _xfind = function () {
  763.         function XFind(f, xf) {
  764.             this.xf = xf;
  765.             this.f = f;
  766.             this.found = false;
  767.         }
  768.         XFind.prototype['@@transducer/init'] = _xfBase.init;
  769.         XFind.prototype['@@transducer/result'] = function (result) {
  770.             if (!this.found) {
  771.                 result = this.xf['@@transducer/step'](result, void 0);
  772.             }
  773.             return this.xf['@@transducer/result'](result);
  774.         };
  775.         XFind.prototype['@@transducer/step'] = function (result, input) {
  776.             if (this.f(input)) {
  777.                 this.found = true;
  778.                 result = _reduced(this.xf['@@transducer/step'](result, input));
  779.             }
  780.             return result;
  781.         };
  782.         return _curry2(function _xfind(f, xf) {
  783.             return new XFind(f, xf);
  784.         });
  785.     }();
  786.  
  787.     var _xfindIndex = function () {
  788.         function XFindIndex(f, xf) {
  789.             this.xf = xf;
  790.             this.f = f;
  791.             this.idx = -1;
  792.             this.found = false;
  793.         }
  794.         XFindIndex.prototype['@@transducer/init'] = _xfBase.init;
  795.         XFindIndex.prototype['@@transducer/result'] = function (result) {
  796.             if (!this.found) {
  797.                 result = this.xf['@@transducer/step'](result, -1);
  798.             }
  799.             return this.xf['@@transducer/result'](result);
  800.         };
  801.         XFindIndex.prototype['@@transducer/step'] = function (result, input) {
  802.             this.idx += 1;
  803.             if (this.f(input)) {
  804.                 this.found = true;
  805.                 result = _reduced(this.xf['@@transducer/step'](result, this.idx));
  806.             }
  807.             return result;
  808.         };
  809.         return _curry2(function _xfindIndex(f, xf) {
  810.             return new XFindIndex(f, xf);
  811.         });
  812.     }();
  813.  
  814.     var _xfindLast = function () {
  815.         function XFindLast(f, xf) {
  816.             this.xf = xf;
  817.             this.f = f;
  818.         }
  819.         XFindLast.prototype['@@transducer/init'] = _xfBase.init;
  820.         XFindLast.prototype['@@transducer/result'] = function (result) {
  821.             return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.last));
  822.         };
  823.         XFindLast.prototype['@@transducer/step'] = function (result, input) {
  824.             if (this.f(input)) {
  825.                 this.last = input;
  826.             }
  827.             return result;
  828.         };
  829.         return _curry2(function _xfindLast(f, xf) {
  830.             return new XFindLast(f, xf);
  831.         });
  832.     }();
  833.  
  834.     var _xfindLastIndex = function () {
  835.         function XFindLastIndex(f, xf) {
  836.             this.xf = xf;
  837.             this.f = f;
  838.             this.idx = -1;
  839.             this.lastIdx = -1;
  840.         }
  841.         XFindLastIndex.prototype['@@transducer/init'] = _xfBase.init;
  842.         XFindLastIndex.prototype['@@transducer/result'] = function (result) {
  843.             return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.lastIdx));
  844.         };
  845.         XFindLastIndex.prototype['@@transducer/step'] = function (result, input) {
  846.             this.idx += 1;
  847.             if (this.f(input)) {
  848.                 this.lastIdx = this.idx;
  849.             }
  850.             return result;
  851.         };
  852.         return _curry2(function _xfindLastIndex(f, xf) {
  853.             return new XFindLastIndex(f, xf);
  854.         });
  855.     }();
  856.  
  857.     var _xmap = function () {
  858.         function XMap(f, xf) {
  859.             this.xf = xf;
  860.             this.f = f;
  861.         }
  862.         XMap.prototype['@@transducer/init'] = _xfBase.init;
  863.         XMap.prototype['@@transducer/result'] = _xfBase.result;
  864.         XMap.prototype['@@transducer/step'] = function (result, input) {
  865.             return this.xf['@@transducer/step'](result, this.f(input));
  866.         };
  867.         return _curry2(function _xmap(f, xf) {
  868.             return new XMap(f, xf);
  869.         });
  870.     }();
  871.  
  872.     var _xreduceBy = function () {
  873.         function XReduceBy(valueFn, valueAcc, keyFn, xf) {
  874.             this.valueFn = valueFn;
  875.             this.valueAcc = valueAcc;
  876.             this.keyFn = keyFn;
  877.             this.xf = xf;
  878.             this.inputs = {};
  879.         }
  880.         XReduceBy.prototype['@@transducer/init'] = _xfBase.init;
  881.         XReduceBy.prototype['@@transducer/result'] = function (result) {
  882.             var key;
  883.             for (key in this.inputs) {
  884.                 if (_has(key, this.inputs)) {
  885.                     result = this.xf['@@transducer/step'](result, this.inputs[key]);
  886.                     if (result['@@transducer/reduced']) {
  887.                         result = result['@@transducer/value'];
  888.                         break;
  889.                     }
  890.                 }
  891.             }
  892.             this.inputs = null;
  893.             return this.xf['@@transducer/result'](result);
  894.         };
  895.         XReduceBy.prototype['@@transducer/step'] = function (result, input) {
  896.             var key = this.keyFn(input);
  897.             this.inputs[key] = this.inputs[key] || [
  898.                 key,
  899.                 this.valueAcc
  900.             ];
  901.             this.inputs[key][1] = this.valueFn(this.inputs[key][1], input);
  902.             return result;
  903.         };
  904.         return _curryN(4, [], function _xreduceBy(valueFn, valueAcc, keyFn, xf) {
  905.             return new XReduceBy(valueFn, valueAcc, keyFn, xf);
  906.         });
  907.     }();
  908.  
  909.     var _xtake = function () {
  910.         function XTake(n, xf) {
  911.             this.xf = xf;
  912.             this.n = n;
  913.             this.i = 0;
  914.         }
  915.         XTake.prototype['@@transducer/init'] = _xfBase.init;
  916.         XTake.prototype['@@transducer/result'] = _xfBase.result;
  917.         XTake.prototype['@@transducer/step'] = function (result, input) {
  918.             this.i += 1;
  919.             var ret = this.n === 0 ? result : this.xf['@@transducer/step'](result, input);
  920.             return this.i >= this.n ? _reduced(ret) : ret;
  921.         };
  922.         return _curry2(function _xtake(n, xf) {
  923.             return new XTake(n, xf);
  924.         });
  925.     }();
  926.  
  927.     var _xtakeWhile = function () {
  928.         function XTakeWhile(f, xf) {
  929.             this.xf = xf;
  930.             this.f = f;
  931.         }
  932.         XTakeWhile.prototype['@@transducer/init'] = _xfBase.init;
  933.         XTakeWhile.prototype['@@transducer/result'] = _xfBase.result;
  934.         XTakeWhile.prototype['@@transducer/step'] = function (result, input) {
  935.             return this.f(input) ? this.xf['@@transducer/step'](result, input) : _reduced(result);
  936.         };
  937.         return _curry2(function _xtakeWhile(f, xf) {
  938.             return new XTakeWhile(f, xf);
  939.         });
  940.     }();
  941.  
  942.     /**
  943.      * Adds two values.
  944.      *
  945.      * @func
  946.      * @memberOf R
  947.      * @since v0.1.0
  948.      * @category Math
  949.      * @sig Number -> Number -> Number
  950.      * @param {Number} a
  951.      * @param {Number} b
  952.      * @return {Number}
  953.      * @see R.subtract
  954.      * @example
  955.      *
  956.      *      R.add(2, 3);       //=>  5
  957.      *      R.add(7)(10);      //=> 17
  958.      */
  959.     var add = _curry2(function add(a, b) {
  960.         return Number(a) + Number(b);
  961.     });
  962.  
  963.     /**
  964.      * Applies a function to the value at the given index of an array, returning a
  965.      * new copy of the array with the element at the given index replaced with the
  966.      * result of the function application.
  967.      *
  968.      * @func
  969.      * @memberOf R
  970.      * @since v0.14.0
  971.      * @category List
  972.      * @sig (a -> a) -> Number -> [a] -> [a]
  973.      * @param {Function} fn The function to apply.
  974.      * @param {Number} idx The index.
  975.      * @param {Array|Arguments} list An array-like object whose value
  976.      *        at the supplied index will be replaced.
  977.      * @return {Array} A copy of the supplied array-like object with
  978.      *         the element at index `idx` replaced with the value
  979.      *         returned by applying `fn` to the existing element.
  980.      * @see R.update
  981.      * @example
  982.      *
  983.      *      R.adjust(R.add(10), 1, [1, 2, 3]);     //=> [1, 12, 3]
  984.      *      R.adjust(R.add(10))(1)([1, 2, 3]);     //=> [1, 12, 3]
  985.      * @symb R.adjust(f, -1, [a, b]) = [a, f(b)]
  986.      * @symb R.adjust(f, 0, [a, b]) = [f(a), b]
  987.      */
  988.     var adjust = _curry3(function adjust(fn, idx, list) {
  989.         if (idx >= list.length || idx < -list.length) {
  990.             return list;
  991.         }
  992.         var start = idx < 0 ? list.length : 0;
  993.         var _idx = start + idx;
  994.         var _list = _concat(list);
  995.         _list[_idx] = fn(list[_idx]);
  996.         return _list;
  997.     });
  998.  
  999.     /**
  1000.      * Returns `true` if all elements of the list match the predicate, `false` if
  1001.      * there are any that don't.
  1002.      *
  1003.      * Dispatches to the `all` method of the second argument, if present.
  1004.      *
  1005.      * Acts as a transducer if a transformer is given in list position.
  1006.      *
  1007.      * @func
  1008.      * @memberOf R
  1009.      * @since v0.1.0
  1010.      * @category List
  1011.      * @sig (a -> Boolean) -> [a] -> Boolean
  1012.      * @param {Function} fn The predicate function.
  1013.      * @param {Array} list The array to consider.
  1014.      * @return {Boolean} `true` if the predicate is satisfied by every element, `false`
  1015.      *         otherwise.
  1016.      * @see R.any, R.none, R.transduce
  1017.      * @example
  1018.      *
  1019.      *      var equals3 = R.equals(3);
  1020.      *      R.all(equals3)([3, 3, 3, 3]); //=> true
  1021.      *      R.all(equals3)([3, 3, 1, 3]); //=> false
  1022.      */
  1023.     var all = _curry2(_dispatchable(['all'], _xall, function all(fn, list) {
  1024.         var idx = 0;
  1025.         while (idx < list.length) {
  1026.             if (!fn(list[idx])) {
  1027.                 return false;
  1028.             }
  1029.             idx += 1;
  1030.         }
  1031.         return true;
  1032.     }));
  1033.  
  1034.     /**
  1035.      * Returns a function that always returns the given value. Note that for
  1036.      * non-primitives the value returned is a reference to the original value.
  1037.      *
  1038.      * This function is known as `const`, `constant`, or `K` (for K combinator) in
  1039.      * other languages and libraries.
  1040.      *
  1041.      * @func
  1042.      * @memberOf R
  1043.      * @since v0.1.0
  1044.      * @category Function
  1045.      * @sig a -> (* -> a)
  1046.      * @param {*} val The value to wrap in a function
  1047.      * @return {Function} A Function :: * -> val.
  1048.      * @example
  1049.      *
  1050.      *      var t = R.always('Tee');
  1051.      *      t(); //=> 'Tee'
  1052.      */
  1053.     var always = _curry1(function always(val) {
  1054.         return function () {
  1055.             return val;
  1056.         };
  1057.     });
  1058.  
  1059.     /**
  1060.      * Returns `true` if both arguments are `true`; `false` otherwise.
  1061.      *
  1062.      * @func
  1063.      * @memberOf R
  1064.      * @since v0.1.0
  1065.      * @category Logic
  1066.      * @sig a -> b -> a | b
  1067.      * @param {Any} a
  1068.      * @param {Any} b
  1069.      * @return {Any} the first argument if it is falsy, otherwise the second argument.
  1070.      * @see R.both
  1071.      * @example
  1072.      *
  1073.      *      R.and(true, true); //=> true
  1074.      *      R.and(true, false); //=> false
  1075.      *      R.and(false, true); //=> false
  1076.      *      R.and(false, false); //=> false
  1077.      */
  1078.     var and = _curry2(function and(a, b) {
  1079.         return a && b;
  1080.     });
  1081.  
  1082.     /**
  1083.      * Returns `true` if at least one of elements of the list match the predicate,
  1084.      * `false` otherwise.
  1085.      *
  1086.      * Dispatches to the `any` method of the second argument, if present.
  1087.      *
  1088.      * Acts as a transducer if a transformer is given in list position.
  1089.      *
  1090.      * @func
  1091.      * @memberOf R
  1092.      * @since v0.1.0
  1093.      * @category List
  1094.      * @sig (a -> Boolean) -> [a] -> Boolean
  1095.      * @param {Function} fn The predicate function.
  1096.      * @param {Array} list The array to consider.
  1097.      * @return {Boolean} `true` if the predicate is satisfied by at least one element, `false`
  1098.      *         otherwise.
  1099.      * @see R.all, R.none, R.transduce
  1100.      * @example
  1101.      *
  1102.      *      var lessThan0 = R.flip(R.lt)(0);
  1103.      *      var lessThan2 = R.flip(R.lt)(2);
  1104.      *      R.any(lessThan0)([1, 2]); //=> false
  1105.      *      R.any(lessThan2)([1, 2]); //=> true
  1106.      */
  1107.     var any = _curry2(_dispatchable(['any'], _xany, function any(fn, list) {
  1108.         var idx = 0;
  1109.         while (idx < list.length) {
  1110.             if (fn(list[idx])) {
  1111.                 return true;
  1112.             }
  1113.             idx += 1;
  1114.         }
  1115.         return false;
  1116.     }));
  1117.  
  1118.     /**
  1119.      * Returns a new list, composed of n-tuples of consecutive elements If `n` is
  1120.      * greater than the length of the list, an empty list is returned.
  1121.      *
  1122.      * Acts as a transducer if a transformer is given in list position.
  1123.      *
  1124.      * @func
  1125.      * @memberOf R
  1126.      * @since v0.12.0
  1127.      * @category List
  1128.      * @sig Number -> [a] -> [[a]]
  1129.      * @param {Number} n The size of the tuples to create
  1130.      * @param {Array} list The list to split into `n`-length tuples
  1131.      * @return {Array} The resulting list of `n`-length tuples
  1132.      * @see R.transduce
  1133.      * @example
  1134.      *
  1135.      *      R.aperture(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [2, 3], [3, 4], [4, 5]]
  1136.      *      R.aperture(3, [1, 2, 3, 4, 5]); //=> [[1, 2, 3], [2, 3, 4], [3, 4, 5]]
  1137.      *      R.aperture(7, [1, 2, 3, 4, 5]); //=> []
  1138.      */
  1139.     var aperture = _curry2(_dispatchable([], _xaperture, _aperture));
  1140.  
  1141.     /**
  1142.      * Returns a new list containing the contents of the given list, followed by
  1143.      * the given element.
  1144.      *
  1145.      * @func
  1146.      * @memberOf R
  1147.      * @since v0.1.0
  1148.      * @category List
  1149.      * @sig a -> [a] -> [a]
  1150.      * @param {*} el The element to add to the end of the new list.
  1151.      * @param {Array} list The list of elements to add a new item to.
  1152.      *        list.
  1153.      * @return {Array} A new list containing the elements of the old list followed by `el`.
  1154.      * @see R.prepend
  1155.      * @example
  1156.      *
  1157.      *      R.append('tests', ['write', 'more']); //=> ['write', 'more', 'tests']
  1158.      *      R.append('tests', []); //=> ['tests']
  1159.      *      R.append(['tests'], ['write', 'more']); //=> ['write', 'more', ['tests']]
  1160.      */
  1161.     var append = _curry2(function append(el, list) {
  1162.         return _concat(list, [el]);
  1163.     });
  1164.  
  1165.     /**
  1166.      * Applies function `fn` to the argument list `args`. This is useful for
  1167.      * creating a fixed-arity function from a variadic function. `fn` should be a
  1168.      * bound function if context is significant.
  1169.      *
  1170.      * @func
  1171.      * @memberOf R
  1172.      * @since v0.7.0
  1173.      * @category Function
  1174.      * @sig (*... -> a) -> [*] -> a
  1175.      * @param {Function} fn The function which will be called with `args`
  1176.      * @param {Array} args The arguments to call `fn` with
  1177.      * @return {*} result The result, equivalent to `fn(...args)`
  1178.      * @see R.call, R.unapply
  1179.      * @example
  1180.      *
  1181.      *      var nums = [1, 2, 3, -99, 42, 6, 7];
  1182.      *      R.apply(Math.max, nums); //=> 42
  1183.      * @symb R.apply(f, [a, b, c]) = f(a, b, c)
  1184.      */
  1185.     var apply = _curry2(function apply(fn, args) {
  1186.         return fn.apply(this, args);
  1187.     });
  1188.  
  1189.     /**
  1190.      * Makes an ascending comparator function out of a function that returns a value
  1191.      * that can be compared with `<` and `>`.
  1192.      *
  1193.      * @func
  1194.      * @memberOf R
  1195.      * @since v0.23.0
  1196.      * @category Function
  1197.      * @sig Ord b => (a -> b) -> a -> a -> Number
  1198.      * @param {Function} fn A function of arity one that returns a value that can be compared
  1199.      * @param {*} a The first item to be compared.
  1200.      * @param {*} b The second item to be compared.
  1201.      * @return {Number} `-1` if fn(a) < fn(b), `1` if fn(b) < fn(a), otherwise `0`
  1202.      * @example
  1203.      *
  1204.      *      var byAge = R.ascend(R.prop('age'));
  1205.      *      var people = [
  1206.      *        // ...
  1207.      *      ];
  1208.      *      var peopleByYoungestFirst = R.sort(byAge, people);
  1209.      */
  1210.     var ascend = _curry3(function ascend(fn, a, b) {
  1211.         var aa = fn(a);
  1212.         var bb = fn(b);
  1213.         return aa < bb ? -1 : aa > bb ? 1 : 0;
  1214.     });
  1215.  
  1216.     /**
  1217.      * Makes a shallow clone of an object, setting or overriding the specified
  1218.      * property with the given value. Note that this copies and flattens prototype
  1219.      * properties onto the new object as well. All non-primitive properties are
  1220.      * copied by reference.
  1221.      *
  1222.      * @func
  1223.      * @memberOf R
  1224.      * @since v0.8.0
  1225.      * @category Object
  1226.      * @sig String -> a -> {k: v} -> {k: v}
  1227.      * @param {String} prop The property name to set
  1228.      * @param {*} val The new value
  1229.      * @param {Object} obj The object to clone
  1230.      * @return {Object} A new object equivalent to the original except for the changed property.
  1231.      * @see R.dissoc
  1232.      * @example
  1233.      *
  1234.      *      R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3}
  1235.      */
  1236.     var assoc = _curry3(function assoc(prop, val, obj) {
  1237.         var result = {};
  1238.         for (var p in obj) {
  1239.             result[p] = obj[p];
  1240.         }
  1241.         result[prop] = val;
  1242.         return result;
  1243.     });
  1244.  
  1245.     /**
  1246.      * Makes a shallow clone of an object, setting or overriding the nodes required
  1247.      * to create the given path, and placing the specific value at the tail end of
  1248.      * that path. Note that this copies and flattens prototype properties onto the
  1249.      * new object as well. All non-primitive properties are copied by reference.
  1250.      *
  1251.      * @func
  1252.      * @memberOf R
  1253.      * @since v0.8.0
  1254.      * @category Object
  1255.      * @typedefn Idx = String | Int
  1256.      * @sig [Idx] -> a -> {a} -> {a}
  1257.      * @param {Array} path the path to set
  1258.      * @param {*} val The new value
  1259.      * @param {Object} obj The object to clone
  1260.      * @return {Object} A new object equivalent to the original except along the specified path.
  1261.      * @see R.dissocPath
  1262.      * @example
  1263.      *
  1264.      *      R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}}
  1265.      *
  1266.      *      // Any missing or non-object keys in path will be overridden
  1267.      *      R.assocPath(['a', 'b', 'c'], 42, {a: 5}); //=> {a: {b: {c: 42}}}
  1268.      */
  1269.     var assocPath = _curry3(function assocPath(path, val, obj) {
  1270.         if (path.length === 0) {
  1271.             return val;
  1272.         }
  1273.         var idx = path[0];
  1274.         if (path.length > 1) {
  1275.             var nextObj = _has(idx, obj) ? obj[idx] : _isInteger(path[1]) ? [] : {};
  1276.             val = assocPath(Array.prototype.slice.call(path, 1), val, nextObj);
  1277.         }
  1278.         if (_isInteger(idx) && _isArray(obj)) {
  1279.             var arr = [].concat(obj);
  1280.             arr[idx] = val;
  1281.             return arr;
  1282.         } else {
  1283.             return assoc(idx, val, obj);
  1284.         }
  1285.     });
  1286.  
  1287.     /**
  1288.      * Creates a function that is bound to a context.
  1289.      * Note: `R.bind` does not provide the additional argument-binding capabilities of
  1290.      * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
  1291.      *
  1292.      * @func
  1293.      * @memberOf R
  1294.      * @since v0.6.0
  1295.      * @category Function
  1296.      * @category Object
  1297.      * @sig (* -> *) -> {*} -> (* -> *)
  1298.      * @param {Function} fn The function to bind to context
  1299.      * @param {Object} thisObj The context to bind `fn` to
  1300.      * @return {Function} A function that will execute in the context of `thisObj`.
  1301.      * @see R.partial
  1302.      * @example
  1303.      *
  1304.      *      var log = R.bind(console.log, console);
  1305.      *      R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3}
  1306.      *      // logs {a: 2}
  1307.      * @symb R.bind(f, o)(a, b) = f.call(o, a, b)
  1308.      */
  1309.     var bind = _curry2(function bind(fn, thisObj) {
  1310.         return _arity(fn.length, function () {
  1311.             return fn.apply(thisObj, arguments);
  1312.         });
  1313.     });
  1314.  
  1315.     /**
  1316.      * Restricts a number to be within a range.
  1317.      *
  1318.      * Also works for other ordered types such as Strings and Dates.
  1319.      *
  1320.      * @func
  1321.      * @memberOf R
  1322.      * @since v0.20.0
  1323.      * @category Relation
  1324.      * @sig Ord a => a -> a -> a -> a
  1325.      * @param {Number} minimum The lower limit of the clamp (inclusive)
  1326.      * @param {Number} maximum The upper limit of the clamp (inclusive)
  1327.      * @param {Number} value Value to be clamped
  1328.      * @return {Number} Returns `minimum` when `val < minimum`, `maximum` when `val > maximum`, returns `val` otherwise
  1329.      * @example
  1330.      *
  1331.      *      R.clamp(1, 10, -5) // => 1
  1332.      *      R.clamp(1, 10, 15) // => 10
  1333.      *      R.clamp(1, 10, 4)  // => 4
  1334.      */
  1335.     var clamp = _curry3(function clamp(min, max, value) {
  1336.         if (min > max) {
  1337.             throw new Error('min must not be greater than max in clamp(min, max, value)');
  1338.         }
  1339.         return value < min ? min : value > max ? max : value;
  1340.     });
  1341.  
  1342.     /**
  1343.      * Makes a comparator function out of a function that reports whether the first
  1344.      * element is less than the second.
  1345.      *
  1346.      * @func
  1347.      * @memberOf R
  1348.      * @since v0.1.0
  1349.      * @category Function
  1350.      * @sig (a, b -> Boolean) -> (a, b -> Number)
  1351.      * @param {Function} pred A predicate function of arity two which will return `true` if the first argument
  1352.      * is less than the second, `false` otherwise
  1353.      * @return {Function} A Function :: a -> b -> Int that returns `-1` if a < b, `1` if b < a, otherwise `0`
  1354.      * @example
  1355.      *
  1356.      *      var byAge = R.comparator((a, b) => a.age < b.age);
  1357.      *      var people = [
  1358.      *        // ...
  1359.      *      ];
  1360.      *      var peopleByIncreasingAge = R.sort(byAge, people);
  1361.      */
  1362.     var comparator = _curry1(function comparator(pred) {
  1363.         return function (a, b) {
  1364.             return pred(a, b) ? -1 : pred(b, a) ? 1 : 0;
  1365.         };
  1366.     });
  1367.  
  1368.     /**
  1369.      * Returns a curried equivalent of the provided function, with the specified
  1370.      * arity. The curried function has two unusual capabilities. First, its
  1371.      * arguments needn't be provided one at a time. If `g` is `R.curryN(3, f)`, the
  1372.      * following are equivalent:
  1373.      *
  1374.      *   - `g(1)(2)(3)`
  1375.      *   - `g(1)(2, 3)`
  1376.      *   - `g(1, 2)(3)`
  1377.      *   - `g(1, 2, 3)`
  1378.      *
  1379.      * Secondly, the special placeholder value `R.__` may be used to specify
  1380.      * "gaps", allowing partial application of any combination of arguments,
  1381.      * regardless of their positions. If `g` is as above and `_` is `R.__`, the
  1382.      * following are equivalent:
  1383.      *
  1384.      *   - `g(1, 2, 3)`
  1385.      *   - `g(_, 2, 3)(1)`
  1386.      *   - `g(_, _, 3)(1)(2)`
  1387.      *   - `g(_, _, 3)(1, 2)`
  1388.      *   - `g(_, 2)(1)(3)`
  1389.      *   - `g(_, 2)(1, 3)`
  1390.      *   - `g(_, 2)(_, 3)(1)`
  1391.      *
  1392.      * @func
  1393.      * @memberOf R
  1394.      * @since v0.5.0
  1395.      * @category Function
  1396.      * @sig Number -> (* -> a) -> (* -> a)
  1397.      * @param {Number} length The arity for the returned function.
  1398.      * @param {Function} fn The function to curry.
  1399.      * @return {Function} A new, curried function.
  1400.      * @see R.curry
  1401.      * @example
  1402.      *
  1403.      *      var sumArgs = (...args) => R.sum(args);
  1404.      *
  1405.      *      var curriedAddFourNumbers = R.curryN(4, sumArgs);
  1406.      *      var f = curriedAddFourNumbers(1, 2);
  1407.      *      var g = f(3);
  1408.      *      g(4); //=> 10
  1409.      */
  1410.     var curryN = _curry2(function curryN(length, fn) {
  1411.         if (length === 1) {
  1412.             return _curry1(fn);
  1413.         }
  1414.         return _arity(length, _curryN(length, [], fn));
  1415.     });
  1416.  
  1417.     /**
  1418.      * Decrements its argument.
  1419.      *
  1420.      * @func
  1421.      * @memberOf R
  1422.      * @since v0.9.0
  1423.      * @category Math
  1424.      * @sig Number -> Number
  1425.      * @param {Number} n
  1426.      * @return {Number} n - 1
  1427.      * @see R.inc
  1428.      * @example
  1429.      *
  1430.      *      R.dec(42); //=> 41
  1431.      */
  1432.     var dec = add(-1);
  1433.  
  1434.     /**
  1435.      * Returns the second argument if it is not `null`, `undefined` or `NaN`
  1436.      * otherwise the first argument is returned.
  1437.      *
  1438.      * @func
  1439.      * @memberOf R
  1440.      * @since v0.10.0
  1441.      * @category Logic
  1442.      * @sig a -> b -> a | b
  1443.      * @param {a} default The default value.
  1444.      * @param {b} val `val` will be returned instead of `default` unless `val` is `null`, `undefined` or `NaN`.
  1445.      * @return {*} The second value if it is not `null`, `undefined` or `NaN`, otherwise the default value
  1446.      * @example
  1447.      *
  1448.      *      var defaultTo42 = R.defaultTo(42);
  1449.      *
  1450.      *      defaultTo42(null);  //=> 42
  1451.      *      defaultTo42(undefined);  //=> 42
  1452.      *      defaultTo42('Ramda');  //=> 'Ramda'
  1453.      *      // parseInt('string') results in NaN
  1454.      *      defaultTo42(parseInt('string')); //=> 42
  1455.      */
  1456.     var defaultTo = _curry2(function defaultTo(d, v) {
  1457.         return v == null || v !== v ? d : v;
  1458.     });
  1459.  
  1460.     /**
  1461.      * Makes a descending comparator function out of a function that returns a value
  1462.      * that can be compared with `<` and `>`.
  1463.      *
  1464.      * @func
  1465.      * @memberOf R
  1466.      * @since v0.23.0
  1467.      * @category Function
  1468.      * @sig Ord b => (a -> b) -> a -> a -> Number
  1469.      * @param {Function} fn A function of arity one that returns a value that can be compared
  1470.      * @param {*} a The first item to be compared.
  1471.      * @param {*} b The second item to be compared.
  1472.      * @return {Number} `-1` if fn(a) > fn(b), `1` if fn(b) > fn(a), otherwise `0`
  1473.      * @example
  1474.      *
  1475.      *      var byAge = R.descend(R.prop('age'));
  1476.      *      var people = [
  1477.      *        // ...
  1478.      *      ];
  1479.      *      var peopleByOldestFirst = R.sort(byAge, people);
  1480.      */
  1481.     var descend = _curry3(function descend(fn, a, b) {
  1482.         var aa = fn(a);
  1483.         var bb = fn(b);
  1484.         return aa > bb ? -1 : aa < bb ? 1 : 0;
  1485.     });
  1486.  
  1487.     /**
  1488.      * Finds the set (i.e. no duplicates) of all elements in the first list not
  1489.      * contained in the second list. Duplication is determined according to the
  1490.      * value returned by applying the supplied predicate to two list elements.
  1491.      *
  1492.      * @func
  1493.      * @memberOf R
  1494.      * @since v0.1.0
  1495.      * @category Relation
  1496.      * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a]
  1497.      * @param {Function} pred A predicate used to test whether two items are equal.
  1498.      * @param {Array} list1 The first list.
  1499.      * @param {Array} list2 The second list.
  1500.      * @return {Array} The elements in `list1` that are not in `list2`.
  1501.      * @see R.difference, R.symmetricDifference, R.symmetricDifferenceWith
  1502.      * @example
  1503.      *
  1504.      *      var cmp = (x, y) => x.a === y.a;
  1505.      *      var l1 = [{a: 1}, {a: 2}, {a: 3}];
  1506.      *      var l2 = [{a: 3}, {a: 4}];
  1507.      *      R.differenceWith(cmp, l1, l2); //=> [{a: 1}, {a: 2}]
  1508.      */
  1509.     var differenceWith = _curry3(function differenceWith(pred, first, second) {
  1510.         var out = [];
  1511.         var idx = 0;
  1512.         var firstLen = first.length;
  1513.         while (idx < firstLen) {
  1514.             if (!_containsWith(pred, first[idx], second) && !_containsWith(pred, first[idx], out)) {
  1515.                 out.push(first[idx]);
  1516.             }
  1517.             idx += 1;
  1518.         }
  1519.         return out;
  1520.     });
  1521.  
  1522.     /**
  1523.      * Returns a new object that does not contain a `prop` property.
  1524.      *
  1525.      * @func
  1526.      * @memberOf R
  1527.      * @since v0.10.0
  1528.      * @category Object
  1529.      * @sig String -> {k: v} -> {k: v}
  1530.      * @param {String} prop The name of the property to dissociate
  1531.      * @param {Object} obj The object to clone
  1532.      * @return {Object} A new object equivalent to the original but without the specified property
  1533.      * @see R.assoc
  1534.      * @example
  1535.      *
  1536.      *      R.dissoc('b', {a: 1, b: 2, c: 3}); //=> {a: 1, c: 3}
  1537.      */
  1538.     var dissoc = _curry2(function dissoc(prop, obj) {
  1539.         var result = {};
  1540.         for (var p in obj) {
  1541.             result[p] = obj[p];
  1542.         }
  1543.         delete result[prop];
  1544.         return result;
  1545.     });
  1546.  
  1547.     /**
  1548.      * Makes a shallow clone of an object, omitting the property at the given path.
  1549.      * Note that this copies and flattens prototype properties onto the new object
  1550.      * as well. All non-primitive properties are copied by reference.
  1551.      *
  1552.      * @func
  1553.      * @memberOf R
  1554.      * @since v0.11.0
  1555.      * @category Object
  1556.      * @sig [String] -> {k: v} -> {k: v}
  1557.      * @param {Array} path The path to the value to omit
  1558.      * @param {Object} obj The object to clone
  1559.      * @return {Object} A new object without the property at path
  1560.      * @see R.assocPath
  1561.      * @example
  1562.      *
  1563.      *      R.dissocPath(['a', 'b', 'c'], {a: {b: {c: 42}}}); //=> {a: {b: {}}}
  1564.      */
  1565.     var dissocPath = _curry2(function dissocPath(path, obj) {
  1566.         switch (path.length) {
  1567.         case 0:
  1568.             return obj;
  1569.         case 1:
  1570.             return dissoc(path[0], obj);
  1571.         default:
  1572.             var head = path[0];
  1573.             var tail = Array.prototype.slice.call(path, 1);
  1574.             return obj[head] == null ? obj : assoc(head, dissocPath(tail, obj[head]), obj);
  1575.         }
  1576.     });
  1577.  
  1578.     /**
  1579.      * Divides two numbers. Equivalent to `a / b`.
  1580.      *
  1581.      * @func
  1582.      * @memberOf R
  1583.      * @since v0.1.0
  1584.      * @category Math
  1585.      * @sig Number -> Number -> Number
  1586.      * @param {Number} a The first value.
  1587.      * @param {Number} b The second value.
  1588.      * @return {Number} The result of `a / b`.
  1589.      * @see R.multiply
  1590.      * @example
  1591.      *
  1592.      *      R.divide(71, 100); //=> 0.71
  1593.      *
  1594.      *      var half = R.divide(R.__, 2);
  1595.      *      half(42); //=> 21
  1596.      *
  1597.      *      var reciprocal = R.divide(1);
  1598.      *      reciprocal(4);   //=> 0.25
  1599.      */
  1600.     var divide = _curry2(function divide(a, b) {
  1601.         return a / b;
  1602.     });
  1603.  
  1604.     /**
  1605.      * Returns a new list excluding the leading elements of a given list which
  1606.      * satisfy the supplied predicate function. It passes each value to the supplied
  1607.      * predicate function, skipping elements while the predicate function returns
  1608.      * `true`. The predicate function is applied to one argument: *(value)*.
  1609.      *
  1610.      * Dispatches to the `dropWhile` method of the second argument, if present.
  1611.      *
  1612.      * Acts as a transducer if a transformer is given in list position.
  1613.      *
  1614.      * @func
  1615.      * @memberOf R
  1616.      * @since v0.9.0
  1617.      * @category List
  1618.      * @sig (a -> Boolean) -> [a] -> [a]
  1619.      * @param {Function} fn The function called per iteration.
  1620.      * @param {Array} list The collection to iterate over.
  1621.      * @return {Array} A new array.
  1622.      * @see R.takeWhile, R.transduce, R.addIndex
  1623.      * @example
  1624.      *
  1625.      *      var lteTwo = x => x <= 2;
  1626.      *
  1627.      *      R.dropWhile(lteTwo, [1, 2, 3, 4, 3, 2, 1]); //=> [3, 4, 3, 2, 1]
  1628.      */
  1629.     var dropWhile = _curry2(_dispatchable(['dropWhile'], _xdropWhile, function dropWhile(pred, list) {
  1630.         var idx = 0;
  1631.         var len = list.length;
  1632.         while (idx < len && pred(list[idx])) {
  1633.             idx += 1;
  1634.         }
  1635.         return Array.prototype.slice.call(list, idx);
  1636.     }));
  1637.  
  1638.     /**
  1639.      * Returns the empty value of its argument's type. Ramda defines the empty
  1640.      * value of Array (`[]`), Object (`{}`), String (`''`), and Arguments. Other
  1641.      * types are supported if they define `<Type>.empty` and/or
  1642.      * `<Type>.prototype.empty`.
  1643.      *
  1644.      * Dispatches to the `empty` method of the first argument, if present.
  1645.      *
  1646.      * @func
  1647.      * @memberOf R
  1648.      * @since v0.3.0
  1649.      * @category Function
  1650.      * @sig a -> a
  1651.      * @param {*} x
  1652.      * @return {*}
  1653.      * @example
  1654.      *
  1655.      *      R.empty(Just(42));      //=> Nothing()
  1656.      *      R.empty([1, 2, 3]);     //=> []
  1657.      *      R.empty('unicorns');    //=> ''
  1658.      *      R.empty({x: 1, y: 2});  //=> {}
  1659.      */
  1660.     // else
  1661.     var empty = _curry1(function empty(x) {
  1662.         return x != null && typeof x.empty === 'function' ? x.empty() : x != null && x.constructor != null && typeof x.constructor.empty === 'function' ? x.constructor.empty() : _isArray(x) ? [] : _isString(x) ? '' : _isObject(x) ? {} : _isArguments(x) ? function () {
  1663.             return arguments;
  1664.         }() : // else
  1665.         void 0;
  1666.     });
  1667.  
  1668.     /**
  1669.      * Creates a new object by recursively evolving a shallow copy of `object`,
  1670.      * according to the `transformation` functions. All non-primitive properties
  1671.      * are copied by reference.
  1672.      *
  1673.      * A `transformation` function will not be invoked if its corresponding key
  1674.      * does not exist in the evolved object.
  1675.      *
  1676.      * @func
  1677.      * @memberOf R
  1678.      * @since v0.9.0
  1679.      * @category Object
  1680.      * @sig {k: (v -> v)} -> {k: v} -> {k: v}
  1681.      * @param {Object} transformations The object specifying transformation functions to apply
  1682.      *        to the object.
  1683.      * @param {Object} object The object to be transformed.
  1684.      * @return {Object} The transformed object.
  1685.      * @example
  1686.      *
  1687.      *      var tomato  = {firstName: '  Tomato ', data: {elapsed: 100, remaining: 1400}, id:123};
  1688.      *      var transformations = {
  1689.      *        firstName: R.trim,
  1690.      *        lastName: R.trim, // Will not get invoked.
  1691.      *        data: {elapsed: R.add(1), remaining: R.add(-1)}
  1692.      *      };
  1693.      *      R.evolve(transformations, tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123}
  1694.      */
  1695.     var evolve = _curry2(function evolve(transformations, object) {
  1696.         var result = {};
  1697.         var transformation, key, type;
  1698.         for (key in object) {
  1699.             transformation = transformations[key];
  1700.             type = typeof transformation;
  1701.             result[key] = type === 'function' ? transformation(object[key]) : transformation && type === 'object' ? evolve(transformation, object[key]) : object[key];
  1702.         }
  1703.         return result;
  1704.     });
  1705.  
  1706.     /**
  1707.      * Returns the first element of the list which matches the predicate, or
  1708.      * `undefined` if no element matches.
  1709.      *
  1710.      * Dispatches to the `find` method of the second argument, if present.
  1711.      *
  1712.      * Acts as a transducer if a transformer is given in list position.
  1713.      *
  1714.      * @func
  1715.      * @memberOf R
  1716.      * @since v0.1.0
  1717.      * @category List
  1718.      * @sig (a -> Boolean) -> [a] -> a | undefined
  1719.      * @param {Function} fn The predicate function used to determine if the element is the
  1720.      *        desired one.
  1721.      * @param {Array} list The array to consider.
  1722.      * @return {Object} The element found, or `undefined`.
  1723.      * @see R.transduce
  1724.      * @example
  1725.      *
  1726.      *      var xs = [{a: 1}, {a: 2}, {a: 3}];
  1727.      *      R.find(R.propEq('a', 2))(xs); //=> {a: 2}
  1728.      *      R.find(R.propEq('a', 4))(xs); //=> undefined
  1729.      */
  1730.     var find = _curry2(_dispatchable(['find'], _xfind, function find(fn, list) {
  1731.         var idx = 0;
  1732.         var len = list.length;
  1733.         while (idx < len) {
  1734.             if (fn(list[idx])) {
  1735.                 return list[idx];
  1736.             }
  1737.             idx += 1;
  1738.         }
  1739.     }));
  1740.  
  1741.     /**
  1742.      * Returns the index of the first element of the list which matches the
  1743.      * predicate, or `-1` if no element matches.
  1744.      *
  1745.      * Acts as a transducer if a transformer is given in list position.
  1746.      *
  1747.      * @func
  1748.      * @memberOf R
  1749.      * @since v0.1.1
  1750.      * @category List
  1751.      * @sig (a -> Boolean) -> [a] -> Number
  1752.      * @param {Function} fn The predicate function used to determine if the element is the
  1753.      * desired one.
  1754.      * @param {Array} list The array to consider.
  1755.      * @return {Number} The index of the element found, or `-1`.
  1756.      * @see R.transduce
  1757.      * @example
  1758.      *
  1759.      *      var xs = [{a: 1}, {a: 2}, {a: 3}];
  1760.      *      R.findIndex(R.propEq('a', 2))(xs); //=> 1
  1761.      *      R.findIndex(R.propEq('a', 4))(xs); //=> -1
  1762.      */
  1763.     var findIndex = _curry2(_dispatchable([], _xfindIndex, function findIndex(fn, list) {
  1764.         var idx = 0;
  1765.         var len = list.length;
  1766.         while (idx < len) {
  1767.             if (fn(list[idx])) {
  1768.                 return idx;
  1769.             }
  1770.             idx += 1;
  1771.         }
  1772.         return -1;
  1773.     }));
  1774.  
  1775.     /**
  1776.      * Returns the last element of the list which matches the predicate, or
  1777.      * `undefined` if no element matches.
  1778.      *
  1779.      * Acts as a transducer if a transformer is given in list position.
  1780.      *
  1781.      * @func
  1782.      * @memberOf R
  1783.      * @since v0.1.1
  1784.      * @category List
  1785.      * @sig (a -> Boolean) -> [a] -> a | undefined
  1786.      * @param {Function} fn The predicate function used to determine if the element is the
  1787.      * desired one.
  1788.      * @param {Array} list The array to consider.
  1789.      * @return {Object} The element found, or `undefined`.
  1790.      * @see R.transduce
  1791.      * @example
  1792.      *
  1793.      *      var xs = [{a: 1, b: 0}, {a:1, b: 1}];
  1794.      *      R.findLast(R.propEq('a', 1))(xs); //=> {a: 1, b: 1}
  1795.      *      R.findLast(R.propEq('a', 4))(xs); //=> undefined
  1796.      */
  1797.     var findLast = _curry2(_dispatchable([], _xfindLast, function findLast(fn, list) {
  1798.         var idx = list.length - 1;
  1799.         while (idx >= 0) {
  1800.             if (fn(list[idx])) {
  1801.                 return list[idx];
  1802.             }
  1803.             idx -= 1;
  1804.         }
  1805.     }));
  1806.  
  1807.     /**
  1808.      * Returns the index of the last element of the list which matches the
  1809.      * predicate, or `-1` if no element matches.
  1810.      *
  1811.      * Acts as a transducer if a transformer is given in list position.
  1812.      *
  1813.      * @func
  1814.      * @memberOf R
  1815.      * @since v0.1.1
  1816.      * @category List
  1817.      * @sig (a -> Boolean) -> [a] -> Number
  1818.      * @param {Function} fn The predicate function used to determine if the element is the
  1819.      * desired one.
  1820.      * @param {Array} list The array to consider.
  1821.      * @return {Number} The index of the element found, or `-1`.
  1822.      * @see R.transduce
  1823.      * @example
  1824.      *
  1825.      *      var xs = [{a: 1, b: 0}, {a:1, b: 1}];
  1826.      *      R.findLastIndex(R.propEq('a', 1))(xs); //=> 1
  1827.      *      R.findLastIndex(R.propEq('a', 4))(xs); //=> -1
  1828.      */
  1829.     var findLastIndex = _curry2(_dispatchable([], _xfindLastIndex, function findLastIndex(fn, list) {
  1830.         var idx = list.length - 1;
  1831.         while (idx >= 0) {
  1832.             if (fn(list[idx])) {
  1833.                 return idx;
  1834.             }
  1835.             idx -= 1;
  1836.         }
  1837.         return -1;
  1838.     }));
  1839.  
  1840.     /**
  1841.      * Iterate over an input `list`, calling a provided function `fn` for each
  1842.      * element in the list.
  1843.      *
  1844.      * `fn` receives one argument: *(value)*.
  1845.      *
  1846.      * Note: `R.forEach` does not skip deleted or unassigned indices (sparse
  1847.      * arrays), unlike the native `Array.prototype.forEach` method. For more
  1848.      * details on this behavior, see:
  1849.      * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Description
  1850.      *
  1851.      * Also note that, unlike `Array.prototype.forEach`, Ramda's `forEach` returns
  1852.      * the original array. In some libraries this function is named `each`.
  1853.      *
  1854.      * Dispatches to the `forEach` method of the second argument, if present.
  1855.      *
  1856.      * @func
  1857.      * @memberOf R
  1858.      * @since v0.1.1
  1859.      * @category List
  1860.      * @sig (a -> *) -> [a] -> [a]
  1861.      * @param {Function} fn The function to invoke. Receives one argument, `value`.
  1862.      * @param {Array} list The list to iterate over.
  1863.      * @return {Array} The original list.
  1864.      * @see R.addIndex
  1865.      * @example
  1866.      *
  1867.      *      var printXPlusFive = x => console.log(x + 5);
  1868.      *      R.forEach(printXPlusFive, [1, 2, 3]); //=> [1, 2, 3]
  1869.      *      // logs 6
  1870.      *      // logs 7
  1871.      *      // logs 8
  1872.      * @symb R.forEach(f, [a, b, c]) = [a, b, c]
  1873.      */
  1874.     var forEach = _curry2(_checkForMethod('forEach', function forEach(fn, list) {
  1875.         var len = list.length;
  1876.         var idx = 0;
  1877.         while (idx < len) {
  1878.             fn(list[idx]);
  1879.             idx += 1;
  1880.         }
  1881.         return list;
  1882.     }));
  1883.  
  1884.     /**
  1885.      * Creates a new object from a list key-value pairs. If a key appears in
  1886.      * multiple pairs, the rightmost pair is included in the object.
  1887.      *
  1888.      * @func
  1889.      * @memberOf R
  1890.      * @since v0.3.0
  1891.      * @category List
  1892.      * @sig [[k,v]] -> {k: v}
  1893.      * @param {Array} pairs An array of two-element arrays that will be the keys and values of the output object.
  1894.      * @return {Object} The object made by pairing up `keys` and `values`.
  1895.      * @see R.toPairs, R.pair
  1896.      * @example
  1897.      *
  1898.      *      R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3}
  1899.      */
  1900.     var fromPairs = _curry1(function fromPairs(pairs) {
  1901.         var result = {};
  1902.         var idx = 0;
  1903.         while (idx < pairs.length) {
  1904.             result[pairs[idx][0]] = pairs[idx][1];
  1905.             idx += 1;
  1906.         }
  1907.         return result;
  1908.     });
  1909.  
  1910.     /**
  1911.      * Takes a list and returns a list of lists where each sublist's elements are
  1912.      * all "equal" according to the provided equality function.
  1913.      *
  1914.      * @func
  1915.      * @memberOf R
  1916.      * @since v0.21.0
  1917.      * @category List
  1918.      * @sig ((a, a) ? Boolean) ? [a] ? [[a]]
  1919.      * @param {Function} fn Function for determining whether two given (adjacent)
  1920.      *        elements should be in the same group
  1921.      * @param {Array} list The array to group. Also accepts a string, which will be
  1922.      *        treated as a list of characters.
  1923.      * @return {List} A list that contains sublists of equal elements,
  1924.      *         whose concatenations are equal to the original list.
  1925.      * @example
  1926.      *
  1927.      * R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21])
  1928.      * //=> [[0], [1, 1], [2], [3], [5], [8], [13], [21]]
  1929.      *
  1930.      * R.groupWith((a, b) => a % 2 === b % 2, [0, 1, 1, 2, 3, 5, 8, 13, 21])
  1931.      * //=> [[0], [1, 1], [2], [3, 5], [8], [13, 21]]
  1932.      *
  1933.      * R.groupWith(R.eqBy(isVowel), 'aestiou')
  1934.      * //=> ['ae', 'st', 'iou']
  1935.      */
  1936.     var groupWith = _curry2(function (fn, list) {
  1937.         var res = [];
  1938.         var idx = 0;
  1939.         var len = list.length;
  1940.         while (idx < len) {
  1941.             var nextidx = idx + 1;
  1942.             while (nextidx < len && fn(list[idx], list[nextidx])) {
  1943.                 nextidx += 1;
  1944.             }
  1945.             res.push(list.slice(idx, nextidx));
  1946.             idx = nextidx;
  1947.         }
  1948.         return res;
  1949.     });
  1950.  
  1951.     /**
  1952.      * Returns `true` if the first argument is greater than the second; `false`
  1953.      * otherwise.
  1954.      *
  1955.      * @func
  1956.      * @memberOf R
  1957.      * @since v0.1.0
  1958.      * @category Relation
  1959.      * @sig Ord a => a -> a -> Boolean
  1960.      * @param {*} a
  1961.      * @param {*} b
  1962.      * @return {Boolean}
  1963.      * @see R.lt
  1964.      * @example
  1965.      *
  1966.      *      R.gt(2, 1); //=> true
  1967.      *      R.gt(2, 2); //=> false
  1968.      *      R.gt(2, 3); //=> false
  1969.      *      R.gt('a', 'z'); //=> false
  1970.      *      R.gt('z', 'a'); //=> true
  1971.      */
  1972.     var gt = _curry2(function gt(a, b) {
  1973.         return a > b;
  1974.     });
  1975.  
  1976.     /**
  1977.      * Returns `true` if the first argument is greater than or equal to the second;
  1978.      * `false` otherwise.
  1979.      *
  1980.      * @func
  1981.      * @memberOf R
  1982.      * @since v0.1.0
  1983.      * @category Relation
  1984.      * @sig Ord a => a -> a -> Boolean
  1985.      * @param {Number} a
  1986.      * @param {Number} b
  1987.      * @return {Boolean}
  1988.      * @see R.lte
  1989.      * @example
  1990.      *
  1991.      *      R.gte(2, 1); //=> true
  1992.      *      R.gte(2, 2); //=> true
  1993.      *      R.gte(2, 3); //=> false
  1994.      *      R.gte('a', 'z'); //=> false
  1995.      *      R.gte('z', 'a'); //=> true
  1996.      */
  1997.     var gte = _curry2(function gte(a, b) {
  1998.         return a >= b;
  1999.     });
  2000.  
  2001.     /**
  2002.      * Returns whether or not an object has an own property with the specified name
  2003.      *
  2004.      * @func
  2005.      * @memberOf R
  2006.      * @since v0.7.0
  2007.      * @category Object
  2008.      * @sig s -> {s: x} -> Boolean
  2009.      * @param {String} prop The name of the property to check for.
  2010.      * @param {Object} obj The object to query.
  2011.      * @return {Boolean} Whether the property exists.
  2012.      * @example
  2013.      *
  2014.      *      var hasName = R.has('name');
  2015.      *      hasName({name: 'alice'});   //=> true
  2016.      *      hasName({name: 'bob'});     //=> true
  2017.      *      hasName({});                //=> false
  2018.      *
  2019.      *      var point = {x: 0, y: 0};
  2020.      *      var pointHas = R.has(R.__, point);
  2021.      *      pointHas('x');  //=> true
  2022.      *      pointHas('y');  //=> true
  2023.      *      pointHas('z');  //=> false
  2024.      */
  2025.     var has = _curry2(_has);
  2026.  
  2027.     /**
  2028.      * Returns whether or not an object or its prototype chain has a property with
  2029.      * the specified name
  2030.      *
  2031.      * @func
  2032.      * @memberOf R
  2033.      * @since v0.7.0
  2034.      * @category Object
  2035.      * @sig s -> {s: x} -> Boolean
  2036.      * @param {String} prop The name of the property to check for.
  2037.      * @param {Object} obj The object to query.
  2038.      * @return {Boolean} Whether the property exists.
  2039.      * @example
  2040.      *
  2041.      *      function Rectangle(width, height) {
  2042.      *        this.width = width;
  2043.      *        this.height = height;
  2044.      *      }
  2045.      *      Rectangle.prototype.area = function() {
  2046.      *        return this.width * this.height;
  2047.      *      };
  2048.      *
  2049.      *      var square = new Rectangle(2, 2);
  2050.      *      R.hasIn('width', square);  //=> true
  2051.      *      R.hasIn('area', square);  //=> true
  2052.      */
  2053.     var hasIn = _curry2(function hasIn(prop, obj) {
  2054.         return prop in obj;
  2055.     });
  2056.  
  2057.     /**
  2058.      * Returns true if its arguments are identical, false otherwise. Values are
  2059.      * identical if they reference the same memory. `NaN` is identical to `NaN`;
  2060.      * `0` and `-0` are not identical.
  2061.      *
  2062.      * @func
  2063.      * @memberOf R
  2064.      * @since v0.15.0
  2065.      * @category Relation
  2066.      * @sig a -> a -> Boolean
  2067.      * @param {*} a
  2068.      * @param {*} b
  2069.      * @return {Boolean}
  2070.      * @example
  2071.      *
  2072.      *      var o = {};
  2073.      *      R.identical(o, o); //=> true
  2074.      *      R.identical(1, 1); //=> true
  2075.      *      R.identical(1, '1'); //=> false
  2076.      *      R.identical([], []); //=> false
  2077.      *      R.identical(0, -0); //=> false
  2078.      *      R.identical(NaN, NaN); //=> true
  2079.      */
  2080.     // SameValue algorithm
  2081.     // Steps 1-5, 7-10
  2082.     // Steps 6.b-6.e: +0 != -0
  2083.     // Step 6.a: NaN == NaN
  2084.     var identical = _curry2(function identical(a, b) {
  2085.         // SameValue algorithm
  2086.         if (a === b) {
  2087.             // Steps 1-5, 7-10
  2088.             // Steps 6.b-6.e: +0 != -0
  2089.             return a !== 0 || 1 / a === 1 / b;
  2090.         } else {
  2091.             // Step 6.a: NaN == NaN
  2092.             return a !== a && b !== b;
  2093.         }
  2094.     });
  2095.  
  2096.     /**
  2097.      * A function that does nothing but return the parameter supplied to it. Good
  2098.      * as a default or placeholder function.
  2099.      *
  2100.      * @func
  2101.      * @memberOf R
  2102.      * @since v0.1.0
  2103.      * @category Function
  2104.      * @sig a -> a
  2105.      * @param {*} x The value to return.
  2106.      * @return {*} The input value, `x`.
  2107.      * @example
  2108.      *
  2109.      *      R.identity(1); //=> 1
  2110.      *
  2111.      *      var obj = {};
  2112.      *      R.identity(obj) === obj; //=> true
  2113.      * @symb R.identity(a) = a
  2114.      */
  2115.     var identity = _curry1(_identity);
  2116.  
  2117.     /**
  2118.      * Creates a function that will process either the `onTrue` or the `onFalse`
  2119.      * function depending upon the result of the `condition` predicate.
  2120.      *
  2121.      * @func
  2122.      * @memberOf R
  2123.      * @since v0.8.0
  2124.      * @category Logic
  2125.      * @sig (*... -> Boolean) -> (*... -> *) -> (*... -> *) -> (*... -> *)
  2126.      * @param {Function} condition A predicate function
  2127.      * @param {Function} onTrue A function to invoke when the `condition` evaluates to a truthy value.
  2128.      * @param {Function} onFalse A function to invoke when the `condition` evaluates to a falsy value.
  2129.      * @return {Function} A new unary function that will process either the `onTrue` or the `onFalse`
  2130.      *                    function depending upon the result of the `condition` predicate.
  2131.      * @see R.unless, R.when
  2132.      * @example
  2133.      *
  2134.      *      var incCount = R.ifElse(
  2135.      *        R.has('count'),
  2136.      *        R.over(R.lensProp('count'), R.inc),
  2137.      *        R.assoc('count', 1)
  2138.      *      );
  2139.      *      incCount({});           //=> { count: 1 }
  2140.      *      incCount({ count: 1 }); //=> { count: 2 }
  2141.      */
  2142.     var ifElse = _curry3(function ifElse(condition, onTrue, onFalse) {
  2143.         return curryN(Math.max(condition.length, onTrue.length, onFalse.length), function _ifElse() {
  2144.             return condition.apply(this, arguments) ? onTrue.apply(this, arguments) : onFalse.apply(this, arguments);
  2145.         });
  2146.     });
  2147.  
  2148.     /**
  2149.      * Increments its argument.
  2150.      *
  2151.      * @func
  2152.      * @memberOf R
  2153.      * @since v0.9.0
  2154.      * @category Math
  2155.      * @sig Number -> Number
  2156.      * @param {Number} n
  2157.      * @return {Number} n + 1
  2158.      * @see R.dec
  2159.      * @example
  2160.      *
  2161.      *      R.inc(42); //=> 43
  2162.      */
  2163.     var inc = add(1);
  2164.  
  2165.     /**
  2166.      * Inserts the supplied element into the list, at index `index`. _Note that
  2167.      * this is not destructive_: it returns a copy of the list with the changes.
  2168.      * <small>No lists have been harmed in the application of this function.</small>
  2169.      *
  2170.      * @func
  2171.      * @memberOf R
  2172.      * @since v0.2.2
  2173.      * @category List
  2174.      * @sig Number -> a -> [a] -> [a]
  2175.      * @param {Number} index The position to insert the element
  2176.      * @param {*} elt The element to insert into the Array
  2177.      * @param {Array} list The list to insert into
  2178.      * @return {Array} A new Array with `elt` inserted at `index`.
  2179.      * @example
  2180.      *
  2181.      *      R.insert(2, 'x', [1,2,3,4]); //=> [1,2,'x',3,4]
  2182.      */
  2183.     var insert = _curry3(function insert(idx, elt, list) {
  2184.         idx = idx < list.length && idx >= 0 ? idx : list.length;
  2185.         var result = Array.prototype.slice.call(list, 0);
  2186.         result.splice(idx, 0, elt);
  2187.         return result;
  2188.     });
  2189.  
  2190.     /**
  2191.      * Inserts the sub-list into the list, at index `index`. _Note that this is not
  2192.      * destructive_: it returns a copy of the list with the changes.
  2193.      * <small>No lists have been harmed in the application of this function.</small>
  2194.      *
  2195.      * @func
  2196.      * @memberOf R
  2197.      * @since v0.9.0
  2198.      * @category List
  2199.      * @sig Number -> [a] -> [a] -> [a]
  2200.      * @param {Number} index The position to insert the sub-list
  2201.      * @param {Array} elts The sub-list to insert into the Array
  2202.      * @param {Array} list The list to insert the sub-list into
  2203.      * @return {Array} A new Array with `elts` inserted starting at `index`.
  2204.      * @example
  2205.      *
  2206.      *      R.insertAll(2, ['x','y','z'], [1,2,3,4]); //=> [1,2,'x','y','z',3,4]
  2207.      */
  2208.     var insertAll = _curry3(function insertAll(idx, elts, list) {
  2209.         idx = idx < list.length && idx >= 0 ? idx : list.length;
  2210.         return [].concat(Array.prototype.slice.call(list, 0, idx), elts, Array.prototype.slice.call(list, idx));
  2211.     });
  2212.  
  2213.     /**
  2214.      * Creates a new list with the separator interposed between elements.
  2215.      *
  2216.      * Dispatches to the `intersperse` method of the second argument, if present.
  2217.      *
  2218.      * @func
  2219.      * @memberOf R
  2220.      * @since v0.14.0
  2221.      * @category List
  2222.      * @sig a -> [a] -> [a]
  2223.      * @param {*} separator The element to add to the list.
  2224.      * @param {Array} list The list to be interposed.
  2225.      * @return {Array} The new list.
  2226.      * @example
  2227.      *
  2228.      *      R.intersperse('n', ['ba', 'a', 'a']); //=> ['ba', 'n', 'a', 'n', 'a']
  2229.      */
  2230.     var intersperse = _curry2(_checkForMethod('intersperse', function intersperse(separator, list) {
  2231.         var out = [];
  2232.         var idx = 0;
  2233.         var length = list.length;
  2234.         while (idx < length) {
  2235.             if (idx === length - 1) {
  2236.                 out.push(list[idx]);
  2237.             } else {
  2238.                 out.push(list[idx], separator);
  2239.             }
  2240.             idx += 1;
  2241.         }
  2242.         return out;
  2243.     }));
  2244.  
  2245.     /**
  2246.      * See if an object (`val`) is an instance of the supplied constructor. This
  2247.      * function will check up the inheritance chain, if any.
  2248.      *
  2249.      * @func
  2250.      * @memberOf R
  2251.      * @since v0.3.0
  2252.      * @category Type
  2253.      * @sig (* -> {*}) -> a -> Boolean
  2254.      * @param {Object} ctor A constructor
  2255.      * @param {*} val The value to test
  2256.      * @return {Boolean}
  2257.      * @example
  2258.      *
  2259.      *      R.is(Object, {}); //=> true
  2260.      *      R.is(Number, 1); //=> true
  2261.      *      R.is(Object, 1); //=> false
  2262.      *      R.is(String, 's'); //=> true
  2263.      *      R.is(String, new String('')); //=> true
  2264.      *      R.is(Object, new String('')); //=> true
  2265.      *      R.is(Object, 's'); //=> false
  2266.      *      R.is(Number, {}); //=> false
  2267.      */
  2268.     var is = _curry2(function is(Ctor, val) {
  2269.         return val != null && val.constructor === Ctor || val instanceof Ctor;
  2270.     });
  2271.  
  2272.     /**
  2273.      * Tests whether or not an object is similar to an array.
  2274.      *
  2275.      * @func
  2276.      * @memberOf R
  2277.      * @since v0.5.0
  2278.      * @category Type
  2279.      * @category List
  2280.      * @sig * -> Boolean
  2281.      * @param {*} x The object to test.
  2282.      * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise.
  2283.      * @deprecated since v0.23.0
  2284.      * @example
  2285.      *
  2286.      *      R.isArrayLike([]); //=> true
  2287.      *      R.isArrayLike(true); //=> false
  2288.      *      R.isArrayLike({}); //=> false
  2289.      *      R.isArrayLike({length: 10}); //=> false
  2290.      *      R.isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true
  2291.      */
  2292.     var isArrayLike = _curry1(function isArrayLike(x) {
  2293.         if (_isArray(x)) {
  2294.             return true;
  2295.         }
  2296.         if (!x) {
  2297.             return false;
  2298.         }
  2299.         if (typeof x !== 'object') {
  2300.             return false;
  2301.         }
  2302.         if (_isString(x)) {
  2303.             return false;
  2304.         }
  2305.         if (x.nodeType === 1) {
  2306.             return !!x.length;
  2307.         }
  2308.         if (x.length === 0) {
  2309.             return true;
  2310.         }
  2311.         if (x.length > 0) {
  2312.             return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);
  2313.         }
  2314.         return false;
  2315.     });
  2316.  
  2317.     /**
  2318.      * Checks if the input value is `null` or `undefined`.
  2319.      *
  2320.      * @func
  2321.      * @memberOf R
  2322.      * @since v0.9.0
  2323.      * @category Type
  2324.      * @sig * -> Boolean
  2325.      * @param {*} x The value to test.
  2326.      * @return {Boolean} `true` if `x` is `undefined` or `null`, otherwise `false`.
  2327.      * @example
  2328.      *
  2329.      *      R.isNil(null); //=> true
  2330.      *      R.isNil(undefined); //=> true
  2331.      *      R.isNil(0); //=> false
  2332.      *      R.isNil([]); //=> false
  2333.      */
  2334.     var isNil = _curry1(function isNil(x) {
  2335.         return x == null;
  2336.     });
  2337.  
  2338.     /**
  2339.      * Returns a list containing the names of all the enumerable own properties of
  2340.      * the supplied object.
  2341.      * Note that the order of the output array is not guaranteed to be consistent
  2342.      * across different JS platforms.
  2343.      *
  2344.      * @func
  2345.      * @memberOf R
  2346.      * @since v0.1.0
  2347.      * @category Object
  2348.      * @sig {k: v} -> [k]
  2349.      * @param {Object} obj The object to extract properties from
  2350.      * @return {Array} An array of the object's own properties.
  2351.      * @example
  2352.      *
  2353.      *      R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c']
  2354.      */
  2355.     // cover IE < 9 keys issues
  2356.     // Safari bug
  2357.     var keys = function () {
  2358.         // cover IE < 9 keys issues
  2359.         var hasEnumBug = !{ toString: null }.propertyIsEnumerable('toString');
  2360.         var nonEnumerableProps = [
  2361.             'constructor',
  2362.             'valueOf',
  2363.             'isPrototypeOf',
  2364.             'toString',
  2365.             'propertyIsEnumerable',
  2366.             'hasOwnProperty',
  2367.             'toLocaleString'
  2368.         ];
  2369.         // Safari bug
  2370.         var hasArgsEnumBug = function () {
  2371.             'use strict';
  2372.             return arguments.propertyIsEnumerable('length');
  2373.         }();
  2374.         var contains = function contains(list, item) {
  2375.             var idx = 0;
  2376.             while (idx < list.length) {
  2377.                 if (list[idx] === item) {
  2378.                     return true;
  2379.                 }
  2380.                 idx += 1;
  2381.             }
  2382.             return false;
  2383.         };
  2384.         return typeof Object.keys === 'function' && !hasArgsEnumBug ? _curry1(function keys(obj) {
  2385.             return Object(obj) !== obj ? [] : Object.keys(obj);
  2386.         }) : _curry1(function keys(obj) {
  2387.             if (Object(obj) !== obj) {
  2388.                 return [];
  2389.             }
  2390.             var prop, nIdx;
  2391.             var ks = [];
  2392.             var checkArgsLength = hasArgsEnumBug && _isArguments(obj);
  2393.             for (prop in obj) {
  2394.                 if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) {
  2395.                     ks[ks.length] = prop;
  2396.                 }
  2397.             }
  2398.             if (hasEnumBug) {
  2399.                 nIdx = nonEnumerableProps.length - 1;
  2400.                 while (nIdx >= 0) {
  2401.                     prop = nonEnumerableProps[nIdx];
  2402.                     if (_has(prop, obj) && !contains(ks, prop)) {
  2403.                         ks[ks.length] = prop;
  2404.                     }
  2405.                     nIdx -= 1;
  2406.                 }
  2407.             }
  2408.             return ks;
  2409.         });
  2410.     }();
  2411.  
  2412.     /**
  2413.      * Returns a list containing the names of all the properties of the supplied
  2414.      * object, including prototype properties.
  2415.      * Note that the order of the output array is not guaranteed to be consistent
  2416.      * across different JS platforms.
  2417.      *
  2418.      * @func
  2419.      * @memberOf R
  2420.      * @since v0.2.0
  2421.      * @category Object
  2422.      * @sig {k: v} -> [k]
  2423.      * @param {Object} obj The object to extract properties from
  2424.      * @return {Array} An array of the object's own and prototype properties.
  2425.      * @example
  2426.      *
  2427.      *      var F = function() { this.x = 'X'; };
  2428.      *      F.prototype.y = 'Y';
  2429.      *      var f = new F();
  2430.      *      R.keysIn(f); //=> ['x', 'y']
  2431.      */
  2432.     var keysIn = _curry1(function keysIn(obj) {
  2433.         var prop;
  2434.         var ks = [];
  2435.         for (prop in obj) {
  2436.             ks[ks.length] = prop;
  2437.         }
  2438.         return ks;
  2439.     });
  2440.  
  2441.     /**
  2442.      * Returns the number of elements in the array by returning `list.length`.
  2443.      *
  2444.      * @func
  2445.      * @memberOf R
  2446.      * @since v0.3.0
  2447.      * @category List
  2448.      * @sig [a] -> Number
  2449.      * @param {Array} list The array to inspect.
  2450.      * @return {Number} The length of the array.
  2451.      * @example
  2452.      *
  2453.      *      R.length([]); //=> 0
  2454.      *      R.length([1, 2, 3]); //=> 3
  2455.      */
  2456.     var length = _curry1(function length(list) {
  2457.         return list != null && _isNumber(list.length) ? list.length : NaN;
  2458.     });
  2459.  
  2460.     /**
  2461.      * Returns `true` if the first argument is less than the second; `false`
  2462.      * otherwise.
  2463.      *
  2464.      * @func
  2465.      * @memberOf R
  2466.      * @since v0.1.0
  2467.      * @category Relation
  2468.      * @sig Ord a => a -> a -> Boolean
  2469.      * @param {*} a
  2470.      * @param {*} b
  2471.      * @return {Boolean}
  2472.      * @see R.gt
  2473.      * @example
  2474.      *
  2475.      *      R.lt(2, 1); //=> false
  2476.      *      R.lt(2, 2); //=> false
  2477.      *      R.lt(2, 3); //=> true
  2478.      *      R.lt('a', 'z'); //=> true
  2479.      *      R.lt('z', 'a'); //=> false
  2480.      */
  2481.     var lt = _curry2(function lt(a, b) {
  2482.         return a < b;
  2483.     });
  2484.  
  2485.     /**
  2486.      * Returns `true` if the first argument is less than or equal to the second;
  2487.      * `false` otherwise.
  2488.      *
  2489.      * @func
  2490.      * @memberOf R
  2491.      * @since v0.1.0
  2492.      * @category Relation
  2493.      * @sig Ord a => a -> a -> Boolean
  2494.      * @param {Number} a
  2495.      * @param {Number} b
  2496.      * @return {Boolean}
  2497.      * @see R.gte
  2498.      * @example
  2499.      *
  2500.      *      R.lte(2, 1); //=> false
  2501.      *      R.lte(2, 2); //=> true
  2502.      *      R.lte(2, 3); //=> true
  2503.      *      R.lte('a', 'z'); //=> true
  2504.      *      R.lte('z', 'a'); //=> false
  2505.      */
  2506.     var lte = _curry2(function lte(a, b) {
  2507.         return a <= b;
  2508.     });
  2509.  
  2510.     /**
  2511.      * The mapAccum function behaves like a combination of map and reduce; it
  2512.      * applies a function to each element of a list, passing an accumulating
  2513.      * parameter from left to right, and returning a final value of this
  2514.      * accumulator together with the new list.
  2515.      *
  2516.      * The iterator function receives two arguments, *acc* and *value*, and should
  2517.      * return a tuple *[acc, value]*.
  2518.      *
  2519.      * @func
  2520.      * @memberOf R
  2521.      * @since v0.10.0
  2522.      * @category List
  2523.      * @sig (acc -> x -> (acc, y)) -> acc -> [x] -> (acc, [y])
  2524.      * @param {Function} fn The function to be called on every element of the input `list`.
  2525.      * @param {*} acc The accumulator value.
  2526.      * @param {Array} list The list to iterate over.
  2527.      * @return {*} The final, accumulated value.
  2528.      * @see R.addIndex, R.mapAccumRight
  2529.      * @example
  2530.      *
  2531.      *      var digits = ['1', '2', '3', '4'];
  2532.      *      var appender = (a, b) => [a + b, a + b];
  2533.      *
  2534.      *      R.mapAccum(appender, 0, digits); //=> ['01234', ['01', '012', '0123', '01234']]
  2535.      * @symb R.mapAccum(f, a, [b, c, d]) = [
  2536.      *   f(f(f(a, b)[0], c)[0], d)[0],
  2537.      *   [
  2538.      *     f(a, b)[1],
  2539.      *     f(f(a, b)[0], c)[1],
  2540.      *     f(f(f(a, b)[0], c)[0], d)[1]
  2541.      *   ]
  2542.      * ]
  2543.      */
  2544.     var mapAccum = _curry3(function mapAccum(fn, acc, list) {
  2545.         var idx = 0;
  2546.         var len = list.length;
  2547.         var result = [];
  2548.         var tuple = [acc];
  2549.         while (idx < len) {
  2550.             tuple = fn(tuple[0], list[idx]);
  2551.             result[idx] = tuple[1];
  2552.             idx += 1;
  2553.         }
  2554.         return [
  2555.             tuple[0],
  2556.             result
  2557.         ];
  2558.     });
  2559.  
  2560.     /**
  2561.      * The mapAccumRight function behaves like a combination of map and reduce; it
  2562.      * applies a function to each element of a list, passing an accumulating
  2563.      * parameter from right to left, and returning a final value of this
  2564.      * accumulator together with the new list.
  2565.      *
  2566.      * Similar to `mapAccum`, except moves through the input list from the right to
  2567.      * the left.
  2568.      *
  2569.      * The iterator function receives two arguments, *value* and *acc*, and should
  2570.      * return a tuple *[value, acc]*.
  2571.      *
  2572.      * @func
  2573.      * @memberOf R
  2574.      * @since v0.10.0
  2575.      * @category List
  2576.      * @sig (x-> acc -> (y, acc)) -> acc -> [x] -> ([y], acc)
  2577.      * @param {Function} fn The function to be called on every element of the input `list`.
  2578.      * @param {*} acc The accumulator value.
  2579.      * @param {Array} list The list to iterate over.
  2580.      * @return {*} The final, accumulated value.
  2581.      * @see R.addIndex, R.mapAccum
  2582.      * @example
  2583.      *
  2584.      *      var digits = ['1', '2', '3', '4'];
  2585.      *      var append = (a, b) => [a + b, a + b];
  2586.      *
  2587.      *      R.mapAccumRight(append, 5, digits); //=> [['12345', '2345', '345', '45'], '12345']
  2588.      * @symb R.mapAccumRight(f, a, [b, c, d]) = [
  2589.      *   [
  2590.      *     f(b, f(c, f(d, a)[0])[0])[1],
  2591.      *     f(c, f(d, a)[0])[1],
  2592.      *     f(d, a)[1],
  2593.      *   ]
  2594.      *   f(b, f(c, f(d, a)[0])[0])[0],
  2595.      * ]
  2596.      */
  2597.     var mapAccumRight = _curry3(function mapAccumRight(fn, acc, list) {
  2598.         var idx = list.length - 1;
  2599.         var result = [];
  2600.         var tuple = [acc];
  2601.         while (idx >= 0) {
  2602.             tuple = fn(list[idx], tuple[0]);
  2603.             result[idx] = tuple[1];
  2604.             idx -= 1;
  2605.         }
  2606.         return [
  2607.             result,
  2608.             tuple[0]
  2609.         ];
  2610.     });
  2611.  
  2612.     /**
  2613.      * Tests a regular expression against a String. Note that this function will
  2614.      * return an empty array when there are no matches. This differs from
  2615.      * [`String.prototype.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match)
  2616.      * which returns `null` when there are no matches.
  2617.      *
  2618.      * @func
  2619.      * @memberOf R
  2620.      * @since v0.1.0
  2621.      * @category String
  2622.      * @sig RegExp -> String -> [String | Undefined]
  2623.      * @param {RegExp} rx A regular expression.
  2624.      * @param {String} str The string to match against
  2625.      * @return {Array} The list of matches or empty array.
  2626.      * @see R.test
  2627.      * @example
  2628.      *
  2629.      *      R.match(/([a-z]a)/g, 'bananas'); //=> ['ba', 'na', 'na']
  2630.      *      R.match(/a/, 'b'); //=> []
  2631.      *      R.match(/a/, null); //=> TypeError: null does not have a method named "match"
  2632.      */
  2633.     var match = _curry2(function match(rx, str) {
  2634.         return str.match(rx) || [];
  2635.     });
  2636.  
  2637.     /**
  2638.      * mathMod behaves like the modulo operator should mathematically, unlike the
  2639.      * `%` operator (and by extension, R.modulo). So while "-17 % 5" is -2,
  2640.      * mathMod(-17, 5) is 3. mathMod requires Integer arguments, and returns NaN
  2641.      * when the modulus is zero or negative.
  2642.      *
  2643.      * @func
  2644.      * @memberOf R
  2645.      * @since v0.3.0
  2646.      * @category Math
  2647.      * @sig Number -> Number -> Number
  2648.      * @param {Number} m The dividend.
  2649.      * @param {Number} p the modulus.
  2650.      * @return {Number} The result of `b mod a`.
  2651.      * @example
  2652.      *
  2653.      *      R.mathMod(-17, 5);  //=> 3
  2654.      *      R.mathMod(17, 5);   //=> 2
  2655.      *      R.mathMod(17, -5);  //=> NaN
  2656.      *      R.mathMod(17, 0);   //=> NaN
  2657.      *      R.mathMod(17.2, 5); //=> NaN
  2658.      *      R.mathMod(17, 5.3); //=> NaN
  2659.      *
  2660.      *      var clock = R.mathMod(R.__, 12);
  2661.      *      clock(15); //=> 3
  2662.      *      clock(24); //=> 0
  2663.      *
  2664.      *      var seventeenMod = R.mathMod(17);
  2665.      *      seventeenMod(3);  //=> 2
  2666.      *      seventeenMod(4);  //=> 1
  2667.      *      seventeenMod(10); //=> 7
  2668.      */
  2669.     var mathMod = _curry2(function mathMod(m, p) {
  2670.         if (!_isInteger(m)) {
  2671.             return NaN;
  2672.         }
  2673.         if (!_isInteger(p) || p < 1) {
  2674.             return NaN;
  2675.         }
  2676.         return (m % p + p) % p;
  2677.     });
  2678.  
  2679.     /**
  2680.      * Returns the larger of its two arguments.
  2681.      *
  2682.      * @func
  2683.      * @memberOf R
  2684.      * @since v0.1.0
  2685.      * @category Relation
  2686.      * @sig Ord a => a -> a -> a
  2687.      * @param {*} a
  2688.      * @param {*} b
  2689.      * @return {*}
  2690.      * @see R.maxBy, R.min
  2691.      * @example
  2692.      *
  2693.      *      R.max(789, 123); //=> 789
  2694.      *      R.max('a', 'b'); //=> 'b'
  2695.      */
  2696.     var max = _curry2(function max(a, b) {
  2697.         return b > a ? b : a;
  2698.     });
  2699.  
  2700.     /**
  2701.      * Takes a function and two values, and returns whichever value produces the
  2702.      * larger result when passed to the provided function.
  2703.      *
  2704.      * @func
  2705.      * @memberOf R
  2706.      * @since v0.8.0
  2707.      * @category Relation
  2708.      * @sig Ord b => (a -> b) -> a -> a -> a
  2709.      * @param {Function} f
  2710.      * @param {*} a
  2711.      * @param {*} b
  2712.      * @return {*}
  2713.      * @see R.max, R.minBy
  2714.      * @example
  2715.      *
  2716.      *      //  square :: Number -> Number
  2717.      *      var square = n => n * n;
  2718.      *
  2719.      *      R.maxBy(square, -3, 2); //=> -3
  2720.      *
  2721.      *      R.reduce(R.maxBy(square), 0, [3, -5, 4, 1, -2]); //=> -5
  2722.      *      R.reduce(R.maxBy(square), 0, []); //=> 0
  2723.      */
  2724.     var maxBy = _curry3(function maxBy(f, a, b) {
  2725.         return f(b) > f(a) ? b : a;
  2726.     });
  2727.  
  2728.     /**
  2729.      * Create a new object with the own properties of the first object merged with
  2730.      * the own properties of the second object. If a key exists in both objects,
  2731.      * the value from the second object will be used.
  2732.      *
  2733.      * @func
  2734.      * @memberOf R
  2735.      * @since v0.1.0
  2736.      * @category Object
  2737.      * @sig {k: v} -> {k: v} -> {k: v}
  2738.      * @param {Object} l
  2739.      * @param {Object} r
  2740.      * @return {Object}
  2741.      * @see R.mergeWith, R.mergeWithKey
  2742.      * @example
  2743.      *
  2744.      *      R.merge({ 'name': 'fred', 'age': 10 }, { 'age': 40 });
  2745.      *      //=> { 'name': 'fred', 'age': 40 }
  2746.      *
  2747.      *      var resetToDefault = R.merge(R.__, {x: 0});
  2748.      *      resetToDefault({x: 5, y: 2}); //=> {x: 0, y: 2}
  2749.      * @symb R.merge({ x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: 5, z: 3 }
  2750.      */
  2751.     var merge = _curry2(function merge(l, r) {
  2752.         return _assign({}, l, r);
  2753.     });
  2754.  
  2755.     /**
  2756.      * Merges a list of objects together into one object.
  2757.      *
  2758.      * @func
  2759.      * @memberOf R
  2760.      * @since v0.10.0
  2761.      * @category List
  2762.      * @sig [{k: v}] -> {k: v}
  2763.      * @param {Array} list An array of objects
  2764.      * @return {Object} A merged object.
  2765.      * @see R.reduce
  2766.      * @example
  2767.      *
  2768.      *      R.mergeAll([{foo:1},{bar:2},{baz:3}]); //=> {foo:1,bar:2,baz:3}
  2769.      *      R.mergeAll([{foo:1},{foo:2},{bar:2}]); //=> {foo:2,bar:2}
  2770.      * @symb R.mergeAll([{ x: 1 }, { y: 2 }, { z: 3 }]) = { x: 1, y: 2, z: 3 }
  2771.      */
  2772.     var mergeAll = _curry1(function mergeAll(list) {
  2773.         return _assign.apply(null, [{}].concat(list));
  2774.     });
  2775.  
  2776.     /**
  2777.      * Creates a new object with the own properties of the two provided objects. If
  2778.      * a key exists in both objects, the provided function is applied to the key
  2779.      * and the values associated with the key in each object, with the result being
  2780.      * used as the value associated with the key in the returned object. The key
  2781.      * will be excluded from the returned object if the resulting value is
  2782.      * `undefined`.
  2783.      *
  2784.      * @func
  2785.      * @memberOf R
  2786.      * @since v0.19.0
  2787.      * @category Object
  2788.      * @sig (String -> a -> a -> a) -> {a} -> {a} -> {a}
  2789.      * @param {Function} fn
  2790.      * @param {Object} l
  2791.      * @param {Object} r
  2792.      * @return {Object}
  2793.      * @see R.merge, R.mergeWith
  2794.      * @example
  2795.      *
  2796.      *      let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r
  2797.      *      R.mergeWithKey(concatValues,
  2798.      *                     { a: true, thing: 'foo', values: [10, 20] },
  2799.      *                     { b: true, thing: 'bar', values: [15, 35] });
  2800.      *      //=> { a: true, b: true, thing: 'bar', values: [10, 20, 15, 35] }
  2801.      * @symb R.mergeWithKey(f, { x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: f('y', 2, 5), z: 3 }
  2802.      */
  2803.     var mergeWithKey = _curry3(function mergeWithKey(fn, l, r) {
  2804.         var result = {};
  2805.         var k;
  2806.         for (k in l) {
  2807.             if (_has(k, l)) {
  2808.                 result[k] = _has(k, r) ? fn(k, l[k], r[k]) : l[k];
  2809.             }
  2810.         }
  2811.         for (k in r) {
  2812.             if (_has(k, r) && !_has(k, result)) {
  2813.                 result[k] = r[k];
  2814.             }
  2815.         }
  2816.         return result;
  2817.     });
  2818.  
  2819.     /**
  2820.      * Returns the smaller of its two arguments.
  2821.      *
  2822.      * @func
  2823.      * @memberOf R
  2824.      * @since v0.1.0
  2825.      * @category Relation
  2826.      * @sig Ord a => a -> a -> a
  2827.      * @param {*} a
  2828.      * @param {*} b
  2829.      * @return {*}
  2830.      * @see R.minBy, R.max
  2831.      * @example
  2832.      *
  2833.      *      R.min(789, 123); //=> 123
  2834.      *      R.min('a', 'b'); //=> 'a'
  2835.      */
  2836.     var min = _curry2(function min(a, b) {
  2837.         return b < a ? b : a;
  2838.     });
  2839.  
  2840.     /**
  2841.      * Takes a function and two values, and returns whichever value produces the
  2842.      * smaller result when passed to the provided function.
  2843.      *
  2844.      * @func
  2845.      * @memberOf R
  2846.      * @since v0.8.0
  2847.      * @category Relation
  2848.      * @sig Ord b => (a -> b) -> a -> a -> a
  2849.      * @param {Function} f
  2850.      * @param {*} a
  2851.      * @param {*} b
  2852.      * @return {*}
  2853.      * @see R.min, R.maxBy
  2854.      * @example
  2855.      *
  2856.      *      //  square :: Number -> Number
  2857.      *      var square = n => n * n;
  2858.      *
  2859.      *      R.minBy(square, -3, 2); //=> 2
  2860.      *
  2861.      *      R.reduce(R.minBy(square), Infinity, [3, -5, 4, 1, -2]); //=> 1
  2862.      *      R.reduce(R.minBy(square), Infinity, []); //=> Infinity
  2863.      */
  2864.     var minBy = _curry3(function minBy(f, a, b) {
  2865.         return f(b) < f(a) ? b : a;
  2866.     });
  2867.  
  2868.     /**
  2869.      * Divides the first parameter by the second and returns the remainder. Note
  2870.      * that this function preserves the JavaScript-style behavior for modulo. For
  2871.      * mathematical modulo see `mathMod`.
  2872.      *
  2873.      * @func
  2874.      * @memberOf R
  2875.      * @since v0.1.1
  2876.      * @category Math
  2877.      * @sig Number -> Number -> Number
  2878.      * @param {Number} a The value to the divide.
  2879.      * @param {Number} b The pseudo-modulus
  2880.      * @return {Number} The result of `b % a`.
  2881.      * @see R.mathMod
  2882.      * @example
  2883.      *
  2884.      *      R.modulo(17, 3); //=> 2
  2885.      *      // JS behavior:
  2886.      *      R.modulo(-17, 3); //=> -2
  2887.      *      R.modulo(17, -3); //=> 2
  2888.      *
  2889.      *      var isOdd = R.modulo(R.__, 2);
  2890.      *      isOdd(42); //=> 0
  2891.      *      isOdd(21); //=> 1
  2892.      */
  2893.     var modulo = _curry2(function modulo(a, b) {
  2894.         return a % b;
  2895.     });
  2896.  
  2897.     /**
  2898.      * Multiplies two numbers. Equivalent to `a * b` but curried.
  2899.      *
  2900.      * @func
  2901.      * @memberOf R
  2902.      * @since v0.1.0
  2903.      * @category Math
  2904.      * @sig Number -> Number -> Number
  2905.      * @param {Number} a The first value.
  2906.      * @param {Number} b The second value.
  2907.      * @return {Number} The result of `a * b`.
  2908.      * @see R.divide
  2909.      * @example
  2910.      *
  2911.      *      var double = R.multiply(2);
  2912.      *      var triple = R.multiply(3);
  2913.      *      double(3);       //=>  6
  2914.      *      triple(4);       //=> 12
  2915.      *      R.multiply(2, 5);  //=> 10
  2916.      */
  2917.     var multiply = _curry2(function multiply(a, b) {
  2918.         return a * b;
  2919.     });
  2920.  
  2921.     /**
  2922.      * Wraps a function of any arity (including nullary) in a function that accepts
  2923.      * exactly `n` parameters. Any extraneous parameters will not be passed to the
  2924.      * supplied function.
  2925.      *
  2926.      * @func
  2927.      * @memberOf R
  2928.      * @since v0.1.0
  2929.      * @category Function
  2930.      * @sig Number -> (* -> a) -> (* -> a)
  2931.      * @param {Number} n The desired arity of the new function.
  2932.      * @param {Function} fn The function to wrap.
  2933.      * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of
  2934.      *         arity `n`.
  2935.      * @example
  2936.      *
  2937.      *      var takesTwoArgs = (a, b) => [a, b];
  2938.      *
  2939.      *      takesTwoArgs.length; //=> 2
  2940.      *      takesTwoArgs(1, 2); //=> [1, 2]
  2941.      *
  2942.      *      var takesOneArg = R.nAry(1, takesTwoArgs);
  2943.      *      takesOneArg.length; //=> 1
  2944.      *      // Only `n` arguments are passed to the wrapped function
  2945.      *      takesOneArg(1, 2); //=> [1, undefined]
  2946.      * @symb R.nAry(0, f)(a, b) = f()
  2947.      * @symb R.nAry(1, f)(a, b) = f(a)
  2948.      * @symb R.nAry(2, f)(a, b) = f(a, b)
  2949.      */
  2950.     var nAry = _curry2(function nAry(n, fn) {
  2951.         switch (n) {
  2952.         case 0:
  2953.             return function () {
  2954.                 return fn.call(this);
  2955.             };
  2956.         case 1:
  2957.             return function (a0) {
  2958.                 return fn.call(this, a0);
  2959.             };
  2960.         case 2:
  2961.             return function (a0, a1) {
  2962.                 return fn.call(this, a0, a1);
  2963.             };
  2964.         case 3:
  2965.             return function (a0, a1, a2) {
  2966.                 return fn.call(this, a0, a1, a2);
  2967.             };
  2968.         case 4:
  2969.             return function (a0, a1, a2, a3) {
  2970.                 return fn.call(this, a0, a1, a2, a3);
  2971.             };
  2972.         case 5:
  2973.             return function (a0, a1, a2, a3, a4) {
  2974.                 return fn.call(this, a0, a1, a2, a3, a4);
  2975.             };
  2976.         case 6:
  2977.             return function (a0, a1, a2, a3, a4, a5) {
  2978.                 return fn.call(this, a0, a1, a2, a3, a4, a5);
  2979.             };
  2980.         case 7:
  2981.             return function (a0, a1, a2, a3, a4, a5, a6) {
  2982.                 return fn.call(this, a0, a1, a2, a3, a4, a5, a6);
  2983.             };
  2984.         case 8:
  2985.             return function (a0, a1, a2, a3, a4, a5, a6, a7) {
  2986.                 return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7);
  2987.             };
  2988.         case 9:
  2989.             return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) {
  2990.                 return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7, a8);
  2991.             };
  2992.         case 10:
  2993.             return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
  2994.                 return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
  2995.             };
  2996.         default:
  2997.             throw new Error('First argument to nAry must be a non-negative integer no greater than ten');
  2998.         }
  2999.     });
  3000.  
  3001.     /**
  3002.      * Negates its argument.
  3003.      *
  3004.      * @func
  3005.      * @memberOf R
  3006.      * @since v0.9.0
  3007.      * @category Math
  3008.      * @sig Number -> Number
  3009.      * @param {Number} n
  3010.      * @return {Number}
  3011.      * @example
  3012.      *
  3013.      *      R.negate(42); //=> -42
  3014.      */
  3015.     var negate = _curry1(function negate(n) {
  3016.         return -n;
  3017.     });
  3018.  
  3019.     /**
  3020.      * Returns `true` if no elements of the list match the predicate, `false`
  3021.      * otherwise.
  3022.      *
  3023.      * Dispatches to the `any` method of the second argument, if present.
  3024.      *
  3025.      * @func
  3026.      * @memberOf R
  3027.      * @since v0.12.0
  3028.      * @category List
  3029.      * @sig (a -> Boolean) -> [a] -> Boolean
  3030.      * @param {Function} fn The predicate function.
  3031.      * @param {Array} list The array to consider.
  3032.      * @return {Boolean} `true` if the predicate is not satisfied by every element, `false` otherwise.
  3033.      * @see R.all, R.any
  3034.      * @example
  3035.      *
  3036.      *      var isEven = n => n % 2 === 0;
  3037.      *
  3038.      *      R.none(isEven, [1, 3, 5, 7, 9, 11]); //=> true
  3039.      *      R.none(isEven, [1, 3, 5, 7, 8, 11]); //=> false
  3040.      */
  3041.     var none = _curry2(_complement(_dispatchable(['any'], _xany, any)));
  3042.  
  3043.     /**
  3044.      * A function that returns the `!` of its argument. It will return `true` when
  3045.      * passed false-y value, and `false` when passed a truth-y one.
  3046.      *
  3047.      * @func
  3048.      * @memberOf R
  3049.      * @since v0.1.0
  3050.      * @category Logic
  3051.      * @sig * -> Boolean
  3052.      * @param {*} a any value
  3053.      * @return {Boolean} the logical inverse of passed argument.
  3054.      * @see R.complement
  3055.      * @example
  3056.      *
  3057.      *      R.not(true); //=> false
  3058.      *      R.not(false); //=> true
  3059.      *      R.not(0); //=> true
  3060.      *      R.not(1); //=> false
  3061.      */
  3062.     var not = _curry1(function not(a) {
  3063.         return !a;
  3064.     });
  3065.  
  3066.     /**
  3067.      * Returns the nth element of the given list or string. If n is negative the
  3068.      * element at index length + n is returned.
  3069.      *
  3070.      * @func
  3071.      * @memberOf R
  3072.      * @since v0.1.0
  3073.      * @category List
  3074.      * @sig Number -> [a] -> a | Undefined
  3075.      * @sig Number -> String -> String
  3076.      * @param {Number} offset
  3077.      * @param {*} list
  3078.      * @return {*}
  3079.      * @example
  3080.      *
  3081.      *      var list = ['foo', 'bar', 'baz', 'quux'];
  3082.      *      R.nth(1, list); //=> 'bar'
  3083.      *      R.nth(-1, list); //=> 'quux'
  3084.      *      R.nth(-99, list); //=> undefined
  3085.      *
  3086.      *      R.nth(2, 'abc'); //=> 'c'
  3087.      *      R.nth(3, 'abc'); //=> ''
  3088.      * @symb R.nth(-1, [a, b, c]) = c
  3089.      * @symb R.nth(0, [a, b, c]) = a
  3090.      * @symb R.nth(1, [a, b, c]) = b
  3091.      */
  3092.     var nth = _curry2(function nth(offset, list) {
  3093.         var idx = offset < 0 ? list.length + offset : offset;
  3094.         return _isString(list) ? list.charAt(idx) : list[idx];
  3095.     });
  3096.  
  3097.     /**
  3098.      * Returns a function which returns its nth argument.
  3099.      *
  3100.      * @func
  3101.      * @memberOf R
  3102.      * @since v0.9.0
  3103.      * @category Function
  3104.      * @sig Number -> *... -> *
  3105.      * @param {Number} n
  3106.      * @return {Function}
  3107.      * @example
  3108.      *
  3109.      *      R.nthArg(1)('a', 'b', 'c'); //=> 'b'
  3110.      *      R.nthArg(-1)('a', 'b', 'c'); //=> 'c'
  3111.      * @symb R.nthArg(-1)(a, b, c) = c
  3112.      * @symb R.nthArg(0)(a, b, c) = a
  3113.      * @symb R.nthArg(1)(a, b, c) = b
  3114.      */
  3115.     var nthArg = _curry1(function nthArg(n) {
  3116.         var arity = n < 0 ? 1 : n + 1;
  3117.         return curryN(arity, function () {
  3118.             return nth(n, arguments);
  3119.         });
  3120.     });
  3121.  
  3122.     /**
  3123.      * Creates an object containing a single key:value pair.
  3124.      *
  3125.      * @func
  3126.      * @memberOf R
  3127.      * @since v0.18.0
  3128.      * @category Object
  3129.      * @sig String -> a -> {String:a}
  3130.      * @param {String} key
  3131.      * @param {*} val
  3132.      * @return {Object}
  3133.      * @see R.pair
  3134.      * @example
  3135.      *
  3136.      *      var matchPhrases = R.compose(
  3137.      *        R.objOf('must'),
  3138.      *        R.map(R.objOf('match_phrase'))
  3139.      *      );
  3140.      *      matchPhrases(['foo', 'bar', 'baz']); //=> {must: [{match_phrase: 'foo'}, {match_phrase: 'bar'}, {match_phrase: 'baz'}]}
  3141.      */
  3142.     var objOf = _curry2(function objOf(key, val) {
  3143.         var obj = {};
  3144.         obj[key] = val;
  3145.         return obj;
  3146.     });
  3147.  
  3148.     /**
  3149.      * Returns a singleton array containing the value provided.
  3150.      *
  3151.      * Note this `of` is different from the ES6 `of`; See
  3152.      * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of
  3153.      *
  3154.      * @func
  3155.      * @memberOf R
  3156.      * @since v0.3.0
  3157.      * @category Function
  3158.      * @sig a -> [a]
  3159.      * @param {*} x any value
  3160.      * @return {Array} An array wrapping `x`.
  3161.      * @example
  3162.      *
  3163.      *      R.of(null); //=> [null]
  3164.      *      R.of([42]); //=> [[42]]
  3165.      */
  3166.     var of = _curry1(_of);
  3167.  
  3168.     /**
  3169.      * Accepts a function `fn` and returns a function that guards invocation of
  3170.      * `fn` such that `fn` can only ever be called once, no matter how many times
  3171.      * the returned function is invoked. The first value calculated is returned in
  3172.      * subsequent invocations.
  3173.      *
  3174.      * @func
  3175.      * @memberOf R
  3176.      * @since v0.1.0
  3177.      * @category Function
  3178.      * @sig (a... -> b) -> (a... -> b)
  3179.      * @param {Function} fn The function to wrap in a call-only-once wrapper.
  3180.      * @return {Function} The wrapped function.
  3181.      * @example
  3182.      *
  3183.      *      var addOneOnce = R.once(x => x + 1);
  3184.      *      addOneOnce(10); //=> 11
  3185.      *      addOneOnce(addOneOnce(50)); //=> 11
  3186.      */
  3187.     var once = _curry1(function once(fn) {
  3188.         var called = false;
  3189.         var result;
  3190.         return _arity(fn.length, function () {
  3191.             if (called) {
  3192.                 return result;
  3193.             }
  3194.             called = true;
  3195.             result = fn.apply(this, arguments);
  3196.             return result;
  3197.         });
  3198.     });
  3199.  
  3200.     /**
  3201.      * Returns `true` if one or both of its arguments are `true`. Returns `false`
  3202.      * if both arguments are `false`.
  3203.      *
  3204.      * @func
  3205.      * @memberOf R
  3206.      * @since v0.1.0
  3207.      * @category Logic
  3208.      * @sig a -> b -> a | b
  3209.      * @param {Any} a
  3210.      * @param {Any} b
  3211.      * @return {Any} the first argument if truthy, otherwise the second argument.
  3212.      * @see R.either
  3213.      * @example
  3214.      *
  3215.      *      R.or(true, true); //=> true
  3216.      *      R.or(true, false); //=> true
  3217.      *      R.or(false, true); //=> true
  3218.      *      R.or(false, false); //=> false
  3219.      */
  3220.     var or = _curry2(function or(a, b) {
  3221.         return a || b;
  3222.     });
  3223.  
  3224.     /**
  3225.      * Returns the result of "setting" the portion of the given data structure
  3226.      * focused by the given lens to the result of applying the given function to
  3227.      * the focused value.
  3228.      *
  3229.      * @func
  3230.      * @memberOf R
  3231.      * @since v0.16.0
  3232.      * @category Object
  3233.      * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
  3234.      * @sig Lens s a -> (a -> a) -> s -> s
  3235.      * @param {Lens} lens
  3236.      * @param {*} v
  3237.      * @param {*} x
  3238.      * @return {*}
  3239.      * @see R.prop, R.lensIndex, R.lensProp
  3240.      * @example
  3241.      *
  3242.      *      var headLens = R.lensIndex(0);
  3243.      *
  3244.      *      R.over(headLens, R.toUpper, ['foo', 'bar', 'baz']); //=> ['FOO', 'bar', 'baz']
  3245.      */
  3246.     // `Identity` is a functor that holds a single value, where `map` simply
  3247.     // transforms the held value with the provided function.
  3248.     // The value returned by the getter function is first transformed with `f`,
  3249.     // then set as the value of an `Identity`. This is then mapped over with the
  3250.     // setter function of the lens.
  3251.     var over = function () {
  3252.         // `Identity` is a functor that holds a single value, where `map` simply
  3253.         // transforms the held value with the provided function.
  3254.         var Identity = function (x) {
  3255.             return {
  3256.                 value: x,
  3257.                 map: function (f) {
  3258.                     return Identity(f(x));
  3259.                 }
  3260.             };
  3261.         };
  3262.         return _curry3(function over(lens, f, x) {
  3263.             // The value returned by the getter function is first transformed with `f`,
  3264.             // then set as the value of an `Identity`. This is then mapped over with the
  3265.             // setter function of the lens.
  3266.             return lens(function (y) {
  3267.                 return Identity(f(y));
  3268.             })(x).value;
  3269.         });
  3270.     }();
  3271.  
  3272.     /**
  3273.      * Takes two arguments, `fst` and `snd`, and returns `[fst, snd]`.
  3274.      *
  3275.      * @func
  3276.      * @memberOf R
  3277.      * @since v0.18.0
  3278.      * @category List
  3279.      * @sig a -> b -> (a,b)
  3280.      * @param {*} fst
  3281.      * @param {*} snd
  3282.      * @return {Array}
  3283.      * @see R.objOf, R.of
  3284.      * @example
  3285.      *
  3286.      *      R.pair('foo', 'bar'); //=> ['foo', 'bar']
  3287.      */
  3288.     var pair = _curry2(function pair(fst, snd) {
  3289.         return [
  3290.             fst,
  3291.             snd
  3292.         ];
  3293.     });
  3294.  
  3295.     /**
  3296.      * Retrieve the value at a given path.
  3297.      *
  3298.      * @func
  3299.      * @memberOf R
  3300.      * @since v0.2.0
  3301.      * @category Object
  3302.      * @typedefn Idx = String | Int
  3303.      * @sig [Idx] -> {a} -> a | Undefined
  3304.      * @param {Array} path The path to use.
  3305.      * @param {Object} obj The object to retrieve the nested property from.
  3306.      * @return {*} The data at `path`.
  3307.      * @see R.prop
  3308.      * @example
  3309.      *
  3310.      *      R.path(['a', 'b'], {a: {b: 2}}); //=> 2
  3311.      *      R.path(['a', 'b'], {c: {b: 2}}); //=> undefined
  3312.      */
  3313.     var path = _curry2(function path(paths, obj) {
  3314.         var val = obj;
  3315.         var idx = 0;
  3316.         while (idx < paths.length) {
  3317.             if (val == null) {
  3318.                 return;
  3319.             }
  3320.             val = val[paths[idx]];
  3321.             idx += 1;
  3322.         }
  3323.         return val;
  3324.     });
  3325.  
  3326.     /**
  3327.      * If the given, non-null object has a value at the given path, returns the
  3328.      * value at that path. Otherwise returns the provided default value.
  3329.      *
  3330.      * @func
  3331.      * @memberOf R
  3332.      * @since v0.18.0
  3333.      * @category Object
  3334.      * @typedefn Idx = String | Int
  3335.      * @sig a -> [Idx] -> {a} -> a
  3336.      * @param {*} d The default value.
  3337.      * @param {Array} p The path to use.
  3338.      * @param {Object} obj The object to retrieve the nested property from.
  3339.      * @return {*} The data at `path` of the supplied object or the default value.
  3340.      * @example
  3341.      *
  3342.      *      R.pathOr('N/A', ['a', 'b'], {a: {b: 2}}); //=> 2
  3343.      *      R.pathOr('N/A', ['a', 'b'], {c: {b: 2}}); //=> "N/A"
  3344.      */
  3345.     var pathOr = _curry3(function pathOr(d, p, obj) {
  3346.         return defaultTo(d, path(p, obj));
  3347.     });
  3348.  
  3349.     /**
  3350.      * Returns `true` if the specified object property at given path satisfies the
  3351.      * given predicate; `false` otherwise.
  3352.      *
  3353.      * @func
  3354.      * @memberOf R
  3355.      * @since v0.19.0
  3356.      * @category Logic
  3357.      * @typedefn Idx = String | Int
  3358.      * @sig (a -> Boolean) -> [Idx] -> {a} -> Boolean
  3359.      * @param {Function} pred
  3360.      * @param {Array} propPath
  3361.      * @param {*} obj
  3362.      * @return {Boolean}
  3363.      * @see R.propSatisfies, R.path
  3364.      * @example
  3365.      *
  3366.      *      R.pathSatisfies(y => y > 0, ['x', 'y'], {x: {y: 2}}); //=> true
  3367.      */
  3368.     var pathSatisfies = _curry3(function pathSatisfies(pred, propPath, obj) {
  3369.         return propPath.length > 0 && pred(path(propPath, obj));
  3370.     });
  3371.  
  3372.     /**
  3373.      * Returns a partial copy of an object containing only the keys specified. If
  3374.      * the key does not exist, the property is ignored.
  3375.      *
  3376.      * @func
  3377.      * @memberOf R
  3378.      * @since v0.1.0
  3379.      * @category Object
  3380.      * @sig [k] -> {k: v} -> {k: v}
  3381.      * @param {Array} names an array of String property names to copy onto a new object
  3382.      * @param {Object} obj The object to copy from
  3383.      * @return {Object} A new object with only properties from `names` on it.
  3384.      * @see R.omit, R.props
  3385.      * @example
  3386.      *
  3387.      *      R.pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4}
  3388.      *      R.pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1}
  3389.      */
  3390.     var pick = _curry2(function pick(names, obj) {
  3391.         var result = {};
  3392.         var idx = 0;
  3393.         while (idx < names.length) {
  3394.             if (names[idx] in obj) {
  3395.                 result[names[idx]] = obj[names[idx]];
  3396.             }
  3397.             idx += 1;
  3398.         }
  3399.         return result;
  3400.     });
  3401.  
  3402.     /**
  3403.      * Similar to `pick` except that this one includes a `key: undefined` pair for
  3404.      * properties that don't exist.
  3405.      *
  3406.      * @func
  3407.      * @memberOf R
  3408.      * @since v0.1.0
  3409.      * @category Object
  3410.      * @sig [k] -> {k: v} -> {k: v}
  3411.      * @param {Array} names an array of String property names to copy onto a new object
  3412.      * @param {Object} obj The object to copy from
  3413.      * @return {Object} A new object with only properties from `names` on it.
  3414.      * @see R.pick
  3415.      * @example
  3416.      *
  3417.      *      R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4}
  3418.      *      R.pickAll(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, e: undefined, f: undefined}
  3419.      */
  3420.     var pickAll = _curry2(function pickAll(names, obj) {
  3421.         var result = {};
  3422.         var idx = 0;
  3423.         var len = names.length;
  3424.         while (idx < len) {
  3425.             var name = names[idx];
  3426.             result[name] = obj[name];
  3427.             idx += 1;
  3428.         }
  3429.         return result;
  3430.     });
  3431.  
  3432.     /**
  3433.      * Returns a partial copy of an object containing only the keys that satisfy
  3434.      * the supplied predicate.
  3435.      *
  3436.      * @func
  3437.      * @memberOf R
  3438.      * @since v0.8.0
  3439.      * @category Object
  3440.      * @sig (v, k -> Boolean) -> {k: v} -> {k: v}
  3441.      * @param {Function} pred A predicate to determine whether or not a key
  3442.      *        should be included on the output object.
  3443.      * @param {Object} obj The object to copy from
  3444.      * @return {Object} A new object with only properties that satisfy `pred`
  3445.      *         on it.
  3446.      * @see R.pick, R.filter
  3447.      * @example
  3448.      *
  3449.      *      var isUpperCase = (val, key) => key.toUpperCase() === key;
  3450.      *      R.pickBy(isUpperCase, {a: 1, b: 2, A: 3, B: 4}); //=> {A: 3, B: 4}
  3451.      */
  3452.     var pickBy = _curry2(function pickBy(test, obj) {
  3453.         var result = {};
  3454.         for (var prop in obj) {
  3455.             if (test(obj[prop], prop, obj)) {
  3456.                 result[prop] = obj[prop];
  3457.             }
  3458.         }
  3459.         return result;
  3460.     });
  3461.  
  3462.     /**
  3463.      * Returns a new list with the given element at the front, followed by the
  3464.      * contents of the list.
  3465.      *
  3466.      * @func
  3467.      * @memberOf R
  3468.      * @since v0.1.0
  3469.      * @category List
  3470.      * @sig a -> [a] -> [a]
  3471.      * @param {*} el The item to add to the head of the output list.
  3472.      * @param {Array} list The array to add to the tail of the output list.
  3473.      * @return {Array} A new array.
  3474.      * @see R.append
  3475.      * @example
  3476.      *
  3477.      *      R.prepend('fee', ['fi', 'fo', 'fum']); //=> ['fee', 'fi', 'fo', 'fum']
  3478.      */
  3479.     var prepend = _curry2(function prepend(el, list) {
  3480.         return _concat([el], list);
  3481.     });
  3482.  
  3483.     /**
  3484.      * Returns a function that when supplied an object returns the indicated
  3485.      * property of that object, if it exists.
  3486.      *
  3487.      * @func
  3488.      * @memberOf R
  3489.      * @since v0.1.0
  3490.      * @category Object
  3491.      * @sig s -> {s: a} -> a | Undefined
  3492.      * @param {String} p The property name
  3493.      * @param {Object} obj The object to query
  3494.      * @return {*} The value at `obj.p`.
  3495.      * @see R.path
  3496.      * @example
  3497.      *
  3498.      *      R.prop('x', {x: 100}); //=> 100
  3499.      *      R.prop('x', {}); //=> undefined
  3500.      */
  3501.     var prop = _curry2(function prop(p, obj) {
  3502.         return obj[p];
  3503.     });
  3504.  
  3505.     /**
  3506.      * Returns `true` if the specified object property is of the given type;
  3507.      * `false` otherwise.
  3508.      *
  3509.      * @func
  3510.      * @memberOf R
  3511.      * @since v0.16.0
  3512.      * @category Type
  3513.      * @sig Type -> String -> Object -> Boolean
  3514.      * @param {Function} type
  3515.      * @param {String} name
  3516.      * @param {*} obj
  3517.      * @return {Boolean}
  3518.      * @see R.is, R.propSatisfies
  3519.      * @example
  3520.      *
  3521.      *      R.propIs(Number, 'x', {x: 1, y: 2});  //=> true
  3522.      *      R.propIs(Number, 'x', {x: 'foo'});    //=> false
  3523.      *      R.propIs(Number, 'x', {});            //=> false
  3524.      */
  3525.     var propIs = _curry3(function propIs(type, name, obj) {
  3526.         return is(type, obj[name]);
  3527.     });
  3528.  
  3529.     /**
  3530.      * If the given, non-null object has an own property with the specified name,
  3531.      * returns the value of that property. Otherwise returns the provided default
  3532.      * value.
  3533.      *
  3534.      * @func
  3535.      * @memberOf R
  3536.      * @since v0.6.0
  3537.      * @category Object
  3538.      * @sig a -> String -> Object -> a
  3539.      * @param {*} val The default value.
  3540.      * @param {String} p The name of the property to return.
  3541.      * @param {Object} obj The object to query.
  3542.      * @return {*} The value of given property of the supplied object or the default value.
  3543.      * @example
  3544.      *
  3545.      *      var alice = {
  3546.      *        name: 'ALICE',
  3547.      *        age: 101
  3548.      *      };
  3549.      *      var favorite = R.prop('favoriteLibrary');
  3550.      *      var favoriteWithDefault = R.propOr('Ramda', 'favoriteLibrary');
  3551.      *
  3552.      *      favorite(alice);  //=> undefined
  3553.      *      favoriteWithDefault(alice);  //=> 'Ramda'
  3554.      */
  3555.     var propOr = _curry3(function propOr(val, p, obj) {
  3556.         return obj != null && _has(p, obj) ? obj[p] : val;
  3557.     });
  3558.  
  3559.     /**
  3560.      * Returns `true` if the specified object property satisfies the given
  3561.      * predicate; `false` otherwise.
  3562.      *
  3563.      * @func
  3564.      * @memberOf R
  3565.      * @since v0.16.0
  3566.      * @category Logic
  3567.      * @sig (a -> Boolean) -> String -> {String: a} -> Boolean
  3568.      * @param {Function} pred
  3569.      * @param {String} name
  3570.      * @param {*} obj
  3571.      * @return {Boolean}
  3572.      * @see R.propEq, R.propIs
  3573.      * @example
  3574.      *
  3575.      *      R.propSatisfies(x => x > 0, 'x', {x: 1, y: 2}); //=> true
  3576.      */
  3577.     var propSatisfies = _curry3(function propSatisfies(pred, name, obj) {
  3578.         return pred(obj[name]);
  3579.     });
  3580.  
  3581.     /**
  3582.      * Acts as multiple `prop`: array of keys in, array of values out. Preserves
  3583.      * order.
  3584.      *
  3585.      * @func
  3586.      * @memberOf R
  3587.      * @since v0.1.0
  3588.      * @category Object
  3589.      * @sig [k] -> {k: v} -> [v]
  3590.      * @param {Array} ps The property names to fetch
  3591.      * @param {Object} obj The object to query
  3592.      * @return {Array} The corresponding values or partially applied function.
  3593.      * @example
  3594.      *
  3595.      *      R.props(['x', 'y'], {x: 1, y: 2}); //=> [1, 2]
  3596.      *      R.props(['c', 'a', 'b'], {b: 2, a: 1}); //=> [undefined, 1, 2]
  3597.      *
  3598.      *      var fullName = R.compose(R.join(' '), R.props(['first', 'last']));
  3599.      *      fullName({last: 'Bullet-Tooth', age: 33, first: 'Tony'}); //=> 'Tony Bullet-Tooth'
  3600.      */
  3601.     var props = _curry2(function props(ps, obj) {
  3602.         var len = ps.length;
  3603.         var out = [];
  3604.         var idx = 0;
  3605.         while (idx < len) {
  3606.             out[idx] = obj[ps[idx]];
  3607.             idx += 1;
  3608.         }
  3609.         return out;
  3610.     });
  3611.  
  3612.     /**
  3613.      * Returns a list of numbers from `from` (inclusive) to `to` (exclusive).
  3614.      *
  3615.      * @func
  3616.      * @memberOf R
  3617.      * @since v0.1.0
  3618.      * @category List
  3619.      * @sig Number -> Number -> [Number]
  3620.      * @param {Number} from The first number in the list.
  3621.      * @param {Number} to One more than the last number in the list.
  3622.      * @return {Array} The list of numbers in tthe set `[a, b)`.
  3623.      * @example
  3624.      *
  3625.      *      R.range(1, 5);    //=> [1, 2, 3, 4]
  3626.      *      R.range(50, 53);  //=> [50, 51, 52]
  3627.      */
  3628.     var range = _curry2(function range(from, to) {
  3629.         if (!(_isNumber(from) && _isNumber(to))) {
  3630.             throw new TypeError('Both arguments to range must be numbers');
  3631.         }
  3632.         var result = [];
  3633.         var n = from;
  3634.         while (n < to) {
  3635.             result.push(n);
  3636.             n += 1;
  3637.         }
  3638.         return result;
  3639.     });
  3640.  
  3641.     /**
  3642.      * Returns a single item by iterating through the list, successively calling
  3643.      * the iterator function and passing it an accumulator value and the current
  3644.      * value from the array, and then passing the result to the next call.
  3645.      *
  3646.      * Similar to `reduce`, except moves through the input list from the right to
  3647.      * the left.
  3648.      *
  3649.      * The iterator function receives two values: *(value, acc)*, while the arguments'
  3650.      * order of `reduce`'s iterator function is *(acc, value)*.
  3651.      *
  3652.      * Note: `R.reduceRight` does not skip deleted or unassigned indices (sparse
  3653.      * arrays), unlike the native `Array.prototype.reduce` method. For more details
  3654.      * on this behavior, see:
  3655.      * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight#Description
  3656.      *
  3657.      * @func
  3658.      * @memberOf R
  3659.      * @since v0.1.0
  3660.      * @category List
  3661.      * @sig (a, b -> b) -> b -> [a] -> b
  3662.      * @param {Function} fn The iterator function. Receives two values, the current element from the array
  3663.      *        and the accumulator.
  3664.      * @param {*} acc The accumulator value.
  3665.      * @param {Array} list The list to iterate over.
  3666.      * @return {*} The final, accumulated value.
  3667.      * @see R.reduce, R.addIndex
  3668.      * @example
  3669.      *
  3670.      *      R.reduceRight(R.subtract, 0, [1, 2, 3, 4]) // => (1 - (2 - (3 - (4 - 0)))) = -2
  3671.      *          -               -2
  3672.      *         / \              / \
  3673.      *        1   -            1   3
  3674.      *           / \              / \
  3675.      *          2   -     ==>    2  -1
  3676.      *             / \              / \
  3677.      *            3   -            3   4
  3678.      *               / \              / \
  3679.      *              4   0            4   0
  3680.      *
  3681.      * @symb R.reduceRight(f, a, [b, c, d]) = f(b, f(c, f(d, a)))
  3682.      */
  3683.     var reduceRight = _curry3(function reduceRight(fn, acc, list) {
  3684.         var idx = list.length - 1;
  3685.         while (idx >= 0) {
  3686.             acc = fn(list[idx], acc);
  3687.             idx -= 1;
  3688.         }
  3689.         return acc;
  3690.     });
  3691.  
  3692.     /**
  3693.      * Returns a value wrapped to indicate that it is the final value of the reduce
  3694.      * and transduce functions. The returned value should be considered a black
  3695.      * box: the internal structure is not guaranteed to be stable.
  3696.      *
  3697.      * Note: this optimization is unavailable to functions not explicitly listed
  3698.      * above. For instance, it is not currently supported by reduceRight.
  3699.      *
  3700.      * @func
  3701.      * @memberOf R
  3702.      * @since v0.15.0
  3703.      * @category List
  3704.      * @sig a -> *
  3705.      * @param {*} x The final value of the reduce.
  3706.      * @return {*} The wrapped value.
  3707.      * @see R.reduce, R.transduce
  3708.      * @example
  3709.      *
  3710.      *      R.reduce(
  3711.      *        R.pipe(R.add, R.when(R.gte(R.__, 10), R.reduced)),
  3712.      *        0,
  3713.      *        [1, 2, 3, 4, 5]) // 10
  3714.      */
  3715.     var reduced = _curry1(_reduced);
  3716.  
  3717.     /**
  3718.      * Removes the sub-list of `list` starting at index `start` and containing
  3719.      * `count` elements. _Note that this is not destructive_: it returns a copy of
  3720.      * the list with the changes.
  3721.      * <small>No lists have been harmed in the application of this function.</small>
  3722.      *
  3723.      * @func
  3724.      * @memberOf R
  3725.      * @since v0.2.2
  3726.      * @category List
  3727.      * @sig Number -> Number -> [a] -> [a]
  3728.      * @param {Number} start The position to start removing elements
  3729.      * @param {Number} count The number of elements to remove
  3730.      * @param {Array} list The list to remove from
  3731.      * @return {Array} A new Array with `count` elements from `start` removed.
  3732.      * @example
  3733.      *
  3734.      *      R.remove(2, 3, [1,2,3,4,5,6,7,8]); //=> [1,2,6,7,8]
  3735.      */
  3736.     var remove = _curry3(function remove(start, count, list) {
  3737.         var result = Array.prototype.slice.call(list, 0);
  3738.         result.splice(start, count);
  3739.         return result;
  3740.     });
  3741.  
  3742.     /**
  3743.      * Replace a substring or regex match in a string with a replacement.
  3744.      *
  3745.      * @func
  3746.      * @memberOf R
  3747.      * @since v0.7.0
  3748.      * @category String
  3749.      * @sig RegExp|String -> String -> String -> String
  3750.      * @param {RegExp|String} pattern A regular expression or a substring to match.
  3751.      * @param {String} replacement The string to replace the matches with.
  3752.      * @param {String} str The String to do the search and replacement in.
  3753.      * @return {String} The result.
  3754.      * @example
  3755.      *
  3756.      *      R.replace('foo', 'bar', 'foo foo foo'); //=> 'bar foo foo'
  3757.      *      R.replace(/foo/, 'bar', 'foo foo foo'); //=> 'bar foo foo'
  3758.      *
  3759.      *      // Use the "g" (global) flag to replace all occurrences:
  3760.      *      R.replace(/foo/g, 'bar', 'foo foo foo'); //=> 'bar bar bar'
  3761.      */
  3762.     var replace = _curry3(function replace(regex, replacement, str) {
  3763.         return str.replace(regex, replacement);
  3764.     });
  3765.  
  3766.     /**
  3767.      * Returns a new list or string with the elements or characters in reverse
  3768.      * order.
  3769.      *
  3770.      * @func
  3771.      * @memberOf R
  3772.      * @since v0.1.0
  3773.      * @category List
  3774.      * @sig [a] -> [a]
  3775.      * @sig String -> String
  3776.      * @param {Array|String} list
  3777.      * @return {Array|String}
  3778.      * @example
  3779.      *
  3780.      *      R.reverse([1, 2, 3]);  //=> [3, 2, 1]
  3781.      *      R.reverse([1, 2]);     //=> [2, 1]
  3782.      *      R.reverse([1]);        //=> [1]
  3783.      *      R.reverse([]);         //=> []
  3784.      *
  3785.      *      R.reverse('abc');      //=> 'cba'
  3786.      *      R.reverse('ab');       //=> 'ba'
  3787.      *      R.reverse('a');        //=> 'a'
  3788.      *      R.reverse('');         //=> ''
  3789.      */
  3790.     var reverse = _curry1(function reverse(list) {
  3791.         return _isString(list) ? list.split('').reverse().join('') : Array.prototype.slice.call(list, 0).reverse();
  3792.     });
  3793.  
  3794.     /**
  3795.      * Scan is similar to reduce, but returns a list of successively reduced values
  3796.      * from the left
  3797.      *
  3798.      * @func
  3799.      * @memberOf R
  3800.      * @since v0.10.0
  3801.      * @category List
  3802.      * @sig (a,b -> a) -> a -> [b] -> [a]
  3803.      * @param {Function} fn The iterator function. Receives two values, the accumulator and the
  3804.      *        current element from the array
  3805.      * @param {*} acc The accumulator value.
  3806.      * @param {Array} list The list to iterate over.
  3807.      * @return {Array} A list of all intermediately reduced values.
  3808.      * @example
  3809.      *
  3810.      *      var numbers = [1, 2, 3, 4];
  3811.      *      var factorials = R.scan(R.multiply, 1, numbers); //=> [1, 1, 2, 6, 24]
  3812.      * @symb R.scan(f, a, [b, c]) = [a, f(a, b), f(f(a, b), c)]
  3813.      */
  3814.     var scan = _curry3(function scan(fn, acc, list) {
  3815.         var idx = 0;
  3816.         var len = list.length;
  3817.         var result = [acc];
  3818.         while (idx < len) {
  3819.             acc = fn(acc, list[idx]);
  3820.             result[idx + 1] = acc;
  3821.             idx += 1;
  3822.         }
  3823.         return result;
  3824.     });
  3825.  
  3826.     /**
  3827.      * Returns the result of "setting" the portion of the given data structure
  3828.      * focused by the given lens to the given value.
  3829.      *
  3830.      * @func
  3831.      * @memberOf R
  3832.      * @since v0.16.0
  3833.      * @category Object
  3834.      * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
  3835.      * @sig Lens s a -> a -> s -> s
  3836.      * @param {Lens} lens
  3837.      * @param {*} v
  3838.      * @param {*} x
  3839.      * @return {*}
  3840.      * @see R.prop, R.lensIndex, R.lensProp
  3841.      * @example
  3842.      *
  3843.      *      var xLens = R.lensProp('x');
  3844.      *
  3845.      *      R.set(xLens, 4, {x: 1, y: 2});  //=> {x: 4, y: 2}
  3846.      *      R.set(xLens, 8, {x: 1, y: 2});  //=> {x: 8, y: 2}
  3847.      */
  3848.     var set = _curry3(function set(lens, v, x) {
  3849.         return over(lens, always(v), x);
  3850.     });
  3851.  
  3852.     /**
  3853.      * Returns the elements of the given list or string (or object with a `slice`
  3854.      * method) from `fromIndex` (inclusive) to `toIndex` (exclusive).
  3855.      *
  3856.      * Dispatches to the `slice` method of the third argument, if present.
  3857.      *
  3858.      * @func
  3859.      * @memberOf R
  3860.      * @since v0.1.4
  3861.      * @category List
  3862.      * @sig Number -> Number -> [a] -> [a]
  3863.      * @sig Number -> Number -> String -> String
  3864.      * @param {Number} fromIndex The start index (inclusive).
  3865.      * @param {Number} toIndex The end index (exclusive).
  3866.      * @param {*} list
  3867.      * @return {*}
  3868.      * @example
  3869.      *
  3870.      *      R.slice(1, 3, ['a', 'b', 'c', 'd']);        //=> ['b', 'c']
  3871.      *      R.slice(1, Infinity, ['a', 'b', 'c', 'd']); //=> ['b', 'c', 'd']
  3872.      *      R.slice(0, -1, ['a', 'b', 'c', 'd']);       //=> ['a', 'b', 'c']
  3873.      *      R.slice(-3, -1, ['a', 'b', 'c', 'd']);      //=> ['b', 'c']
  3874.      *      R.slice(0, 3, 'ramda');                     //=> 'ram'
  3875.      */
  3876.     var slice = _curry3(_checkForMethod('slice', function slice(fromIndex, toIndex, list) {
  3877.         return Array.prototype.slice.call(list, fromIndex, toIndex);
  3878.     }));
  3879.  
  3880.     /**
  3881.      * Returns a copy of the list, sorted according to the comparator function,
  3882.      * which should accept two values at a time and return a negative number if the
  3883.      * first value is smaller, a positive number if it's larger, and zero if they
  3884.      * are equal. Please note that this is a **copy** of the list. It does not
  3885.      * modify the original.
  3886.      *
  3887.      * @func
  3888.      * @memberOf R
  3889.      * @since v0.1.0
  3890.      * @category List
  3891.      * @sig (a,a -> Number) -> [a] -> [a]
  3892.      * @param {Function} comparator A sorting function :: a -> b -> Int
  3893.      * @param {Array} list The list to sort
  3894.      * @return {Array} a new array with its elements sorted by the comparator function.
  3895.      * @example
  3896.      *
  3897.      *      var diff = function(a, b) { return a - b; };
  3898.      *      R.sort(diff, [4,2,7,5]); //=> [2, 4, 5, 7]
  3899.      */
  3900.     var sort = _curry2(function sort(comparator, list) {
  3901.         return Array.prototype.slice.call(list, 0).sort(comparator);
  3902.     });
  3903.  
  3904.     /**
  3905.      * Sorts the list according to the supplied function.
  3906.      *
  3907.      * @func
  3908.      * @memberOf R
  3909.      * @since v0.1.0
  3910.      * @category Relation
  3911.      * @sig Ord b => (a -> b) -> [a] -> [a]
  3912.      * @param {Function} fn
  3913.      * @param {Array} list The list to sort.
  3914.      * @return {Array} A new list sorted by the keys generated by `fn`.
  3915.      * @example
  3916.      *
  3917.      *      var sortByFirstItem = R.sortBy(R.prop(0));
  3918.      *      var sortByNameCaseInsensitive = R.sortBy(R.compose(R.toLower, R.prop('name')));
  3919.      *      var pairs = [[-1, 1], [-2, 2], [-3, 3]];
  3920.      *      sortByFirstItem(pairs); //=> [[-3, 3], [-2, 2], [-1, 1]]
  3921.      *      var alice = {
  3922.      *        name: 'ALICE',
  3923.      *        age: 101
  3924.      *      };
  3925.      *      var bob = {
  3926.      *        name: 'Bob',
  3927.      *        age: -10
  3928.      *      };
  3929.      *      var clara = {
  3930.      *        name: 'clara',
  3931.      *        age: 314.159
  3932.      *      };
  3933.      *      var people = [clara, bob, alice];
  3934.      *      sortByNameCaseInsensitive(people); //=> [alice, bob, clara]
  3935.      */
  3936.     var sortBy = _curry2(function sortBy(fn, list) {
  3937.         return Array.prototype.slice.call(list, 0).sort(function (a, b) {
  3938.             var aa = fn(a);
  3939.             var bb = fn(b);
  3940.             return aa < bb ? -1 : aa > bb ? 1 : 0;
  3941.         });
  3942.     });
  3943.  
  3944.     /**
  3945.      * Sorts a list according to a list of comparators.
  3946.      *
  3947.      * @func
  3948.      * @memberOf R
  3949.      * @since v0.23.0
  3950.      * @category Relation
  3951.      * @sig [a -> a -> Number] -> [a] -> [a]
  3952.      * @param {Array} functions A list of comparator functions.
  3953.      * @param {Array} list The list to sort.
  3954.      * @return {Array} A new list sorted according to the comarator functions.
  3955.      * @example
  3956.      *
  3957.      *      var alice = {
  3958.      *        name: 'alice',
  3959.      *        age: 40
  3960.      *      };
  3961.      *      var bob = {
  3962.      *        name: 'bob',
  3963.      *        age: 30
  3964.      *      };
  3965.      *      var clara = {
  3966.      *        name: 'clara',
  3967.      *        age: 40
  3968.      *      };
  3969.      *      var people = [clara, bob, alice];
  3970.      *      var ageNameSort = R.sortWith([
  3971.      *        R.descend(R.prop('age')),
  3972.      *        R.ascend(R.prop('name'))
  3973.      *      ]);
  3974.      *      ageNameSort(people); //=> [alice, clara, bob]
  3975.      */
  3976.     var sortWith = _curry2(function sortWith(fns, list) {
  3977.         return Array.prototype.slice.call(list, 0).sort(function (a, b) {
  3978.             var result = 0;
  3979.             var i = 0;
  3980.             while (result === 0 && i < fns.length) {
  3981.                 result = fns[i](a, b);
  3982.                 i += 1;
  3983.             }
  3984.             return result;
  3985.         });
  3986.     });
  3987.  
  3988.     /**
  3989.      * Splits a given list or string at a given index.
  3990.      *
  3991.      * @func
  3992.      * @memberOf R
  3993.      * @since v0.19.0
  3994.      * @category List
  3995.      * @sig Number -> [a] -> [[a], [a]]
  3996.      * @sig Number -> String -> [String, String]
  3997.      * @param {Number} index The index where the array/string is split.
  3998.      * @param {Array|String} array The array/string to be split.
  3999.      * @return {Array}
  4000.      * @example
  4001.      *
  4002.      *      R.splitAt(1, [1, 2, 3]);          //=> [[1], [2, 3]]
  4003.      *      R.splitAt(5, 'hello world');      //=> ['hello', ' world']
  4004.      *      R.splitAt(-1, 'foobar');          //=> ['fooba', 'r']
  4005.      */
  4006.     var splitAt = _curry2(function splitAt(index, array) {
  4007.         return [
  4008.             slice(0, index, array),
  4009.             slice(index, length(array), array)
  4010.         ];
  4011.     });
  4012.  
  4013.     /**
  4014.      * Splits a collection into slices of the specified length.
  4015.      *
  4016.      * @func
  4017.      * @memberOf R
  4018.      * @since v0.16.0
  4019.      * @category List
  4020.      * @sig Number -> [a] -> [[a]]
  4021.      * @sig Number -> String -> [String]
  4022.      * @param {Number} n
  4023.      * @param {Array} list
  4024.      * @return {Array}
  4025.      * @example
  4026.      *
  4027.      *      R.splitEvery(3, [1, 2, 3, 4, 5, 6, 7]); //=> [[1, 2, 3], [4, 5, 6], [7]]
  4028.      *      R.splitEvery(3, 'foobarbaz'); //=> ['foo', 'bar', 'baz']
  4029.      */
  4030.     var splitEvery = _curry2(function splitEvery(n, list) {
  4031.         if (n <= 0) {
  4032.             throw new Error('First argument to splitEvery must be a positive integer');
  4033.         }
  4034.         var result = [];
  4035.         var idx = 0;
  4036.         while (idx < list.length) {
  4037.             result.push(slice(idx, idx += n, list));
  4038.         }
  4039.         return result;
  4040.     });
  4041.  
  4042.     /**
  4043.      * Takes a list and a predicate and returns a pair of lists with the following properties:
  4044.      *
  4045.      *  - the result of concatenating the two output lists is equivalent to the input list;
  4046.      *  - none of the elements of the first output list satisfies the predicate; and
  4047.      *  - if the second output list is non-empty, its first element satisfies the predicate.
  4048.      *
  4049.      * @func
  4050.      * @memberOf R
  4051.      * @since v0.19.0
  4052.      * @category List
  4053.      * @sig (a -> Boolean) -> [a] -> [[a], [a]]
  4054.      * @param {Function} pred The predicate that determines where the array is split.
  4055.      * @param {Array} list The array to be split.
  4056.      * @return {Array}
  4057.      * @example
  4058.      *
  4059.      *      R.splitWhen(R.equals(2), [1, 2, 3, 1, 2, 3]);   //=> [[1], [2, 3, 1, 2, 3]]
  4060.      */
  4061.     var splitWhen = _curry2(function splitWhen(pred, list) {
  4062.         var idx = 0;
  4063.         var len = list.length;
  4064.         var prefix = [];
  4065.         while (idx < len && !pred(list[idx])) {
  4066.             prefix.push(list[idx]);
  4067.             idx += 1;
  4068.         }
  4069.         return [
  4070.             prefix,
  4071.             Array.prototype.slice.call(list, idx)
  4072.         ];
  4073.     });
  4074.  
  4075.     /**
  4076.      * Subtracts its second argument from its first argument.
  4077.      *
  4078.      * @func
  4079.      * @memberOf R
  4080.      * @since v0.1.0
  4081.      * @category Math
  4082.      * @sig Number -> Number -> Number
  4083.      * @param {Number} a The first value.
  4084.      * @param {Number} b The second value.
  4085.      * @return {Number} The result of `a - b`.
  4086.      * @see R.add
  4087.      * @example
  4088.      *
  4089.      *      R.subtract(10, 8); //=> 2
  4090.      *
  4091.      *      var minus5 = R.subtract(R.__, 5);
  4092.      *      minus5(17); //=> 12
  4093.      *
  4094.      *      var complementaryAngle = R.subtract(90);
  4095.      *      complementaryAngle(30); //=> 60
  4096.      *      complementaryAngle(72); //=> 18
  4097.      */
  4098.     var subtract = _curry2(function subtract(a, b) {
  4099.         return Number(a) - Number(b);
  4100.     });
  4101.  
  4102.     /**
  4103.      * Returns all but the first element of the given list or string (or object
  4104.      * with a `tail` method).
  4105.      *
  4106.      * Dispatches to the `slice` method of the first argument, if present.
  4107.      *
  4108.      * @func
  4109.      * @memberOf R
  4110.      * @since v0.1.0
  4111.      * @category List
  4112.      * @sig [a] -> [a]
  4113.      * @sig String -> String
  4114.      * @param {*} list
  4115.      * @return {*}
  4116.      * @see R.head, R.init, R.last
  4117.      * @example
  4118.      *
  4119.      *      R.tail([1, 2, 3]);  //=> [2, 3]
  4120.      *      R.tail([1, 2]);     //=> [2]
  4121.      *      R.tail([1]);        //=> []
  4122.      *      R.tail([]);         //=> []
  4123.      *
  4124.      *      R.tail('abc');  //=> 'bc'
  4125.      *      R.tail('ab');   //=> 'b'
  4126.      *      R.tail('a');    //=> ''
  4127.      *      R.tail('');     //=> ''
  4128.      */
  4129.     var tail = _curry1(_checkForMethod('tail', slice(1, Infinity)));
  4130.  
  4131.     /**
  4132.      * Returns the first `n` elements of the given list, string, or
  4133.      * transducer/transformer (or object with a `take` method).
  4134.      *
  4135.      * Dispatches to the `take` method of the second argument, if present.
  4136.      *
  4137.      * @func
  4138.      * @memberOf R
  4139.      * @since v0.1.0
  4140.      * @category List
  4141.      * @sig Number -> [a] -> [a]
  4142.      * @sig Number -> String -> String
  4143.      * @param {Number} n
  4144.      * @param {*} list
  4145.      * @return {*}
  4146.      * @see R.drop
  4147.      * @example
  4148.      *
  4149.      *      R.take(1, ['foo', 'bar', 'baz']); //=> ['foo']
  4150.      *      R.take(2, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']
  4151.      *      R.take(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
  4152.      *      R.take(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
  4153.      *      R.take(3, 'ramda');               //=> 'ram'
  4154.      *
  4155.      *      var personnel = [
  4156.      *        'Dave Brubeck',
  4157.      *        'Paul Desmond',
  4158.      *        'Eugene Wright',
  4159.      *        'Joe Morello',
  4160.      *        'Gerry Mulligan',
  4161.      *        'Bob Bates',
  4162.      *        'Joe Dodge',
  4163.      *        'Ron Crotty'
  4164.      *      ];
  4165.      *
  4166.      *      var takeFive = R.take(5);
  4167.      *      takeFive(personnel);
  4168.      *      //=> ['Dave Brubeck', 'Paul Desmond', 'Eugene Wright', 'Joe Morello', 'Gerry Mulligan']
  4169.      * @symb R.take(-1, [a, b]) = [a, b]
  4170.      * @symb R.take(0, [a, b]) = []
  4171.      * @symb R.take(1, [a, b]) = [a]
  4172.      * @symb R.take(2, [a, b]) = [a, b]
  4173.      */
  4174.     var take = _curry2(_dispatchable(['take'], _xtake, function take(n, xs) {
  4175.         return slice(0, n < 0 ? Infinity : n, xs);
  4176.     }));
  4177.  
  4178.     /**
  4179.      * Returns a new list containing the last `n` elements of a given list, passing
  4180.      * each value to the supplied predicate function, and terminating when the
  4181.      * predicate function returns `false`. Excludes the element that caused the
  4182.      * predicate function to fail. The predicate function is passed one argument:
  4183.      * *(value)*.
  4184.      *
  4185.      * @func
  4186.      * @memberOf R
  4187.      * @since v0.16.0
  4188.      * @category List
  4189.      * @sig (a -> Boolean) -> [a] -> [a]
  4190.      * @param {Function} fn The function called per iteration.
  4191.      * @param {Array} list The collection to iterate over.
  4192.      * @return {Array} A new array.
  4193.      * @see R.dropLastWhile, R.addIndex
  4194.      * @example
  4195.      *
  4196.      *      var isNotOne = x => x !== 1;
  4197.      *
  4198.      *      R.takeLastWhile(isNotOne, [1, 2, 3, 4]); //=> [2, 3, 4]
  4199.      */
  4200.     var takeLastWhile = _curry2(function takeLastWhile(fn, list) {
  4201.         var idx = list.length - 1;
  4202.         while (idx >= 0 && fn(list[idx])) {
  4203.             idx -= 1;
  4204.         }
  4205.         return Array.prototype.slice.call(list, idx + 1);
  4206.     });
  4207.  
  4208.     /**
  4209.      * Returns a new list containing the first `n` elements of a given list,
  4210.      * passing each value to the supplied predicate function, and terminating when
  4211.      * the predicate function returns `false`. Excludes the element that caused the
  4212.      * predicate function to fail. The predicate function is passed one argument:
  4213.      * *(value)*.
  4214.      *
  4215.      * Dispatches to the `takeWhile` method of the second argument, if present.
  4216.      *
  4217.      * Acts as a transducer if a transformer is given in list position.
  4218.      *
  4219.      * @func
  4220.      * @memberOf R
  4221.      * @since v0.1.0
  4222.      * @category List
  4223.      * @sig (a -> Boolean) -> [a] -> [a]
  4224.      * @param {Function} fn The function called per iteration.
  4225.      * @param {Array} list The collection to iterate over.
  4226.      * @return {Array} A new array.
  4227.      * @see R.dropWhile, R.transduce, R.addIndex
  4228.      * @example
  4229.      *
  4230.      *      var isNotFour = x => x !== 4;
  4231.      *
  4232.      *      R.takeWhile(isNotFour, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3]
  4233.      */
  4234.     var takeWhile = _curry2(_dispatchable(['takeWhile'], _xtakeWhile, function takeWhile(fn, list) {
  4235.         var idx = 0;
  4236.         var len = list.length;
  4237.         while (idx < len && fn(list[idx])) {
  4238.             idx += 1;
  4239.         }
  4240.         return Array.prototype.slice.call(list, 0, idx);
  4241.     }));
  4242.  
  4243.     /**
  4244.      * Runs the given function with the supplied object, then returns the object.
  4245.      *
  4246.      * @func
  4247.      * @memberOf R
  4248.      * @since v0.1.0
  4249.      * @category Function
  4250.      * @sig (a -> *) -> a -> a
  4251.      * @param {Function} fn The function to call with `x`. The return value of `fn` will be thrown away.
  4252.      * @param {*} x
  4253.      * @return {*} `x`.
  4254.      * @example
  4255.      *
  4256.      *      var sayX = x => console.log('x is ' + x);
  4257.      *      R.tap(sayX, 100); //=> 100
  4258.      *      // logs 'x is 100'
  4259.      * @symb R.tap(f, a) = a
  4260.      */
  4261.     var tap = _curry2(function tap(fn, x) {
  4262.         fn(x);
  4263.         return x;
  4264.     });
  4265.  
  4266.     /**
  4267.      * Calls an input function `n` times, returning an array containing the results
  4268.      * of those function calls.
  4269.      *
  4270.      * `fn` is passed one argument: The current value of `n`, which begins at `0`
  4271.      * and is gradually incremented to `n - 1`.
  4272.      *
  4273.      * @func
  4274.      * @memberOf R
  4275.      * @since v0.2.3
  4276.      * @category List
  4277.      * @sig (Number -> a) -> Number -> [a]
  4278.      * @param {Function} fn The function to invoke. Passed one argument, the current value of `n`.
  4279.      * @param {Number} n A value between `0` and `n - 1`. Increments after each function call.
  4280.      * @return {Array} An array containing the return values of all calls to `fn`.
  4281.      * @example
  4282.      *
  4283.      *      R.times(R.identity, 5); //=> [0, 1, 2, 3, 4]
  4284.      * @symb R.times(f, 0) = []
  4285.      * @symb R.times(f, 1) = [f(0)]
  4286.      * @symb R.times(f, 2) = [f(0), f(1)]
  4287.      */
  4288.     var times = _curry2(function times(fn, n) {
  4289.         var len = Number(n);
  4290.         var idx = 0;
  4291.         var list;
  4292.         if (len < 0 || isNaN(len)) {
  4293.             throw new RangeError('n must be a non-negative number');
  4294.         }
  4295.         list = new Array(len);
  4296.         while (idx < len) {
  4297.             list[idx] = fn(idx);
  4298.             idx += 1;
  4299.         }
  4300.         return list;
  4301.     });
  4302.  
  4303.     /**
  4304.      * Converts an object into an array of key, value arrays. Only the object's
  4305.      * own properties are used.
  4306.      * Note that the order of the output array is not guaranteed to be consistent
  4307.      * across different JS platforms.
  4308.      *
  4309.      * @func
  4310.      * @memberOf R
  4311.      * @since v0.4.0
  4312.      * @category Object
  4313.      * @sig {String: *} -> [[String,*]]
  4314.      * @param {Object} obj The object to extract from
  4315.      * @return {Array} An array of key, value arrays from the object's own properties.
  4316.      * @see R.fromPairs
  4317.      * @example
  4318.      *
  4319.      *      R.toPairs({a: 1, b: 2, c: 3}); //=> [['a', 1], ['b', 2], ['c', 3]]
  4320.      */
  4321.     var toPairs = _curry1(function toPairs(obj) {
  4322.         var pairs = [];
  4323.         for (var prop in obj) {
  4324.             if (_has(prop, obj)) {
  4325.                 pairs[pairs.length] = [
  4326.                     prop,
  4327.                     obj[prop]
  4328.                 ];
  4329.             }
  4330.         }
  4331.         return pairs;
  4332.     });
  4333.  
  4334.     /**
  4335.      * Converts an object into an array of key, value arrays. The object's own
  4336.      * properties and prototype properties are used. Note that the order of the
  4337.      * output array is not guaranteed to be consistent across different JS
  4338.      * platforms.
  4339.      *
  4340.      * @func
  4341.      * @memberOf R
  4342.      * @since v0.4.0
  4343.      * @category Object
  4344.      * @sig {String: *} -> [[String,*]]
  4345.      * @param {Object} obj The object to extract from
  4346.      * @return {Array} An array of key, value arrays from the object's own
  4347.      *         and prototype properties.
  4348.      * @example
  4349.      *
  4350.      *      var F = function() { this.x = 'X'; };
  4351.      *      F.prototype.y = 'Y';
  4352.      *      var f = new F();
  4353.      *      R.toPairsIn(f); //=> [['x','X'], ['y','Y']]
  4354.      */
  4355.     var toPairsIn = _curry1(function toPairsIn(obj) {
  4356.         var pairs = [];
  4357.         for (var prop in obj) {
  4358.             pairs[pairs.length] = [
  4359.                 prop,
  4360.                 obj[prop]
  4361.             ];
  4362.         }
  4363.         return pairs;
  4364.     });
  4365.  
  4366.     /**
  4367.      * Transposes the rows and columns of a 2D list.
  4368.      * When passed a list of `n` lists of length `x`,
  4369.      * returns a list of `x` lists of length `n`.
  4370.      *
  4371.      *
  4372.      * @func
  4373.      * @memberOf R
  4374.      * @since v0.19.0
  4375.      * @category List
  4376.      * @sig [[a]] -> [[a]]
  4377.      * @param {Array} list A 2D list
  4378.      * @return {Array} A 2D list
  4379.      * @example
  4380.      *
  4381.      *      R.transpose([[1, 'a'], [2, 'b'], [3, 'c']]) //=> [[1, 2, 3], ['a', 'b', 'c']]
  4382.      *      R.transpose([[1, 2, 3], ['a', 'b', 'c']]) //=> [[1, 'a'], [2, 'b'], [3, 'c']]
  4383.      *
  4384.      * If some of the rows are shorter than the following rows, their elements are skipped:
  4385.      *
  4386.      *      R.transpose([[10, 11], [20], [], [30, 31, 32]]) //=> [[10, 20, 30], [11, 31], [32]]
  4387.      * @symb R.transpose([[a], [b], [c]]) = [a, b, c]
  4388.      * @symb R.transpose([[a, b], [c, d]]) = [[a, c], [b, d]]
  4389.      * @symb R.transpose([[a, b], [c]]) = [[a, c], [b]]
  4390.      */
  4391.     var transpose = _curry1(function transpose(outerlist) {
  4392.         var i = 0;
  4393.         var result = [];
  4394.         while (i < outerlist.length) {
  4395.             var innerlist = outerlist[i];
  4396.             var j = 0;
  4397.             while (j < innerlist.length) {
  4398.                 if (typeof result[j] === 'undefined') {
  4399.                     result[j] = [];
  4400.                 }
  4401.                 result[j].push(innerlist[j]);
  4402.                 j += 1;
  4403.             }
  4404.             i += 1;
  4405.         }
  4406.         return result;
  4407.     });
  4408.  
  4409.     /**
  4410.      * Removes (strips) whitespace from both ends of the string.
  4411.      *
  4412.      * @func
  4413.      * @memberOf R
  4414.      * @since v0.6.0
  4415.      * @category String
  4416.      * @sig String -> String
  4417.      * @param {String} str The string to trim.
  4418.      * @return {String} Trimmed version of `str`.
  4419.      * @example
  4420.      *
  4421.      *      R.trim('   xyz  '); //=> 'xyz'
  4422.      *      R.map(R.trim, R.split(',', 'x, y, z')); //=> ['x', 'y', 'z']
  4423.      */
  4424.     var trim = function () {
  4425.         var ws = '\t\n\x0B\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003' + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' + '\u2029\uFEFF';
  4426.         var zeroWidth = '\u200B';
  4427.         var hasProtoTrim = typeof String.prototype.trim === 'function';
  4428.         if (!hasProtoTrim || (ws.trim() || !zeroWidth.trim())) {
  4429.             return _curry1(function trim(str) {
  4430.                 var beginRx = new RegExp('^[' + ws + '][' + ws + ']*');
  4431.                 var endRx = new RegExp('[' + ws + '][' + ws + ']*$');
  4432.                 return str.replace(beginRx, '').replace(endRx, '');
  4433.             });
  4434.         } else {
  4435.             return _curry1(function trim(str) {
  4436.                 return str.trim();
  4437.             });
  4438.         }
  4439.     }();
  4440.  
  4441.     /**
  4442.      * `tryCatch` takes two functions, a `tryer` and a `catcher`. The returned
  4443.      * function evaluates the `tryer`; if it does not throw, it simply returns the
  4444.      * result. If the `tryer` *does* throw, the returned function evaluates the
  4445.      * `catcher` function and returns its result. Note that for effective
  4446.      * composition with this function, both the `tryer` and `catcher` functions
  4447.      * must return the same type of results.
  4448.      *
  4449.      * @func
  4450.      * @memberOf R
  4451.      * @since v0.20.0
  4452.      * @category Function
  4453.      * @sig (...x -> a) -> ((e, ...x) -> a) -> (...x -> a)
  4454.      * @param {Function} tryer The function that may throw.
  4455.      * @param {Function} catcher The function that will be evaluated if `tryer` throws.
  4456.      * @return {Function} A new function that will catch exceptions and send then to the catcher.
  4457.      * @example
  4458.      *
  4459.      *      R.tryCatch(R.prop('x'), R.F)({x: true}); //=> true
  4460.      *      R.tryCatch(R.prop('x'), R.F)(null);      //=> false
  4461.      */
  4462.     var tryCatch = _curry2(function _tryCatch(tryer, catcher) {
  4463.         return _arity(tryer.length, function () {
  4464.             try {
  4465.                 return tryer.apply(this, arguments);
  4466.             } catch (e) {
  4467.                 return catcher.apply(this, _concat([e], arguments));
  4468.             }
  4469.         });
  4470.     });
  4471.  
  4472.     /**
  4473.      * Gives a single-word string description of the (native) type of a value,
  4474.      * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not
  4475.      * attempt to distinguish user Object types any further, reporting them all as
  4476.      * 'Object'.
  4477.      *
  4478.      * @func
  4479.      * @memberOf R
  4480.      * @since v0.8.0
  4481.      * @category Type
  4482.      * @sig (* -> {*}) -> String
  4483.      * @param {*} val The value to test
  4484.      * @return {String}
  4485.      * @example
  4486.      *
  4487.      *      R.type({}); //=> "Object"
  4488.      *      R.type(1); //=> "Number"
  4489.      *      R.type(false); //=> "Boolean"
  4490.      *      R.type('s'); //=> "String"
  4491.      *      R.type(null); //=> "Null"
  4492.      *      R.type([]); //=> "Array"
  4493.      *      R.type(/[A-z]/); //=> "RegExp"
  4494.      */
  4495.     var type = _curry1(function type(val) {
  4496.         return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);
  4497.     });
  4498.  
  4499.     /**
  4500.      * Takes a function `fn`, which takes a single array argument, and returns a
  4501.      * function which:
  4502.      *
  4503.      *   - takes any number of positional arguments;
  4504.      *   - passes these arguments to `fn` as an array; and
  4505.      *   - returns the result.
  4506.      *
  4507.      * In other words, R.unapply derives a variadic function from a function which
  4508.      * takes an array. R.unapply is the inverse of R.apply.
  4509.      *
  4510.      * @func
  4511.      * @memberOf R
  4512.      * @since v0.8.0
  4513.      * @category Function
  4514.      * @sig ([*...] -> a) -> (*... -> a)
  4515.      * @param {Function} fn
  4516.      * @return {Function}
  4517.      * @see R.apply
  4518.      * @example
  4519.      *
  4520.      *      R.unapply(JSON.stringify)(1, 2, 3); //=> '[1,2,3]'
  4521.      * @symb R.unapply(f)(a, b) = f([a, b])
  4522.      */
  4523.     var unapply = _curry1(function unapply(fn) {
  4524.         return function () {
  4525.             return fn(Array.prototype.slice.call(arguments, 0));
  4526.         };
  4527.     });
  4528.  
  4529.     /**
  4530.      * Wraps a function of any arity (including nullary) in a function that accepts
  4531.      * exactly 1 parameter. Any extraneous parameters will not be passed to the
  4532.      * supplied function.
  4533.      *
  4534.      * @func
  4535.      * @memberOf R
  4536.      * @since v0.2.0
  4537.      * @category Function
  4538.      * @sig (* -> b) -> (a -> b)
  4539.      * @param {Function} fn The function to wrap.
  4540.      * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of
  4541.      *         arity 1.
  4542.      * @example
  4543.      *
  4544.      *      var takesTwoArgs = function(a, b) {
  4545.      *        return [a, b];
  4546.      *      };
  4547.      *      takesTwoArgs.length; //=> 2
  4548.      *      takesTwoArgs(1, 2); //=> [1, 2]
  4549.      *
  4550.      *      var takesOneArg = R.unary(takesTwoArgs);
  4551.      *      takesOneArg.length; //=> 1
  4552.      *      // Only 1 argument is passed to the wrapped function
  4553.      *      takesOneArg(1, 2); //=> [1, undefined]
  4554.      * @symb R.unary(f)(a, b, c) = f(a)
  4555.      */
  4556.     var unary = _curry1(function unary(fn) {
  4557.         return nAry(1, fn);
  4558.     });
  4559.  
  4560.     /**
  4561.      * Returns a function of arity `n` from a (manually) curried function.
  4562.      *
  4563.      * @func
  4564.      * @memberOf R
  4565.      * @since v0.14.0
  4566.      * @category Function
  4567.      * @sig Number -> (a -> b) -> (a -> c)
  4568.      * @param {Number} length The arity for the returned function.
  4569.      * @param {Function} fn The function to uncurry.
  4570.      * @return {Function} A new function.
  4571.      * @see R.curry
  4572.      * @example
  4573.      *
  4574.      *      var addFour = a => b => c => d => a + b + c + d;
  4575.      *
  4576.      *      var uncurriedAddFour = R.uncurryN(4, addFour);
  4577.      *      uncurriedAddFour(1, 2, 3, 4); //=> 10
  4578.      */
  4579.     var uncurryN = _curry2(function uncurryN(depth, fn) {
  4580.         return curryN(depth, function () {
  4581.             var currentDepth = 1;
  4582.             var value = fn;
  4583.             var idx = 0;
  4584.             var endIdx;
  4585.             while (currentDepth <= depth && typeof value === 'function') {
  4586.                 endIdx = currentDepth === depth ? arguments.length : idx + value.length;
  4587.                 value = value.apply(this, Array.prototype.slice.call(arguments, idx, endIdx));
  4588.                 currentDepth += 1;
  4589.                 idx = endIdx;
  4590.             }
  4591.             return value;
  4592.         });
  4593.     });
  4594.  
  4595.     /**
  4596.      * Builds a list from a seed value. Accepts an iterator function, which returns
  4597.      * either false to stop iteration or an array of length 2 containing the value
  4598.      * to add to the resulting list and the seed to be used in the next call to the
  4599.      * iterator function.
  4600.      *
  4601.      * The iterator function receives one argument: *(seed)*.
  4602.      *
  4603.      * @func
  4604.      * @memberOf R
  4605.      * @since v0.10.0
  4606.      * @category List
  4607.      * @sig (a -> [b]) -> * -> [b]
  4608.      * @param {Function} fn The iterator function. receives one argument, `seed`, and returns
  4609.      *        either false to quit iteration or an array of length two to proceed. The element
  4610.      *        at index 0 of this array will be added to the resulting array, and the element
  4611.      *        at index 1 will be passed to the next call to `fn`.
  4612.      * @param {*} seed The seed value.
  4613.      * @return {Array} The final list.
  4614.      * @example
  4615.      *
  4616.      *      var f = n => n > 50 ? false : [-n, n + 10];
  4617.      *      R.unfold(f, 10); //=> [-10, -20, -30, -40, -50]
  4618.      * @symb R.unfold(f, x) = [f(x)[0], f(f(x)[1])[0], f(f(f(x)[1])[1])[0], ...]
  4619.      */
  4620.     var unfold = _curry2(function unfold(fn, seed) {
  4621.         var pair = fn(seed);
  4622.         var result = [];
  4623.         while (pair && pair.length) {
  4624.             result[result.length] = pair[0];
  4625.             pair = fn(pair[1]);
  4626.         }
  4627.         return result;
  4628.     });
  4629.  
  4630.     /**
  4631.      * Returns a new list containing only one copy of each element in the original
  4632.      * list, based upon the value returned by applying the supplied predicate to
  4633.      * two list elements. Prefers the first item if two items compare equal based
  4634.      * on the predicate.
  4635.      *
  4636.      * @func
  4637.      * @memberOf R
  4638.      * @since v0.2.0
  4639.      * @category List
  4640.      * @sig (a, a -> Boolean) -> [a] -> [a]
  4641.      * @param {Function} pred A predicate used to test whether two items are equal.
  4642.      * @param {Array} list The array to consider.
  4643.      * @return {Array} The list of unique items.
  4644.      * @example
  4645.      *
  4646.      *      var strEq = R.eqBy(String);
  4647.      *      R.uniqWith(strEq)([1, '1', 2, 1]); //=> [1, 2]
  4648.      *      R.uniqWith(strEq)([{}, {}]);       //=> [{}]
  4649.      *      R.uniqWith(strEq)([1, '1', 1]);    //=> [1]
  4650.      *      R.uniqWith(strEq)(['1', 1, 1]);    //=> ['1']
  4651.      */
  4652.     var uniqWith = _curry2(function uniqWith(pred, list) {
  4653.         var idx = 0;
  4654.         var len = list.length;
  4655.         var result = [];
  4656.         var item;
  4657.         while (idx < len) {
  4658.             item = list[idx];
  4659.             if (!_containsWith(pred, item, result)) {
  4660.                 result[result.length] = item;
  4661.             }
  4662.             idx += 1;
  4663.         }
  4664.         return result;
  4665.     });
  4666.  
  4667.     /**
  4668.      * Tests the final argument by passing it to the given predicate function. If
  4669.      * the predicate is not satisfied, the function will return the result of
  4670.      * calling the `whenFalseFn` function with the same argument. If the predicate
  4671.      * is satisfied, the argument is returned as is.
  4672.      *
  4673.      * @func
  4674.      * @memberOf R
  4675.      * @since v0.18.0
  4676.      * @category Logic
  4677.      * @sig (a -> Boolean) -> (a -> a) -> a -> a
  4678.      * @param {Function} pred        A predicate function
  4679.      * @param {Function} whenFalseFn A function to invoke when the `pred` evaluates
  4680.      *                               to a falsy value.
  4681.      * @param {*}        x           An object to test with the `pred` function and
  4682.      *                               pass to `whenFalseFn` if necessary.
  4683.      * @return {*} Either `x` or the result of applying `x` to `whenFalseFn`.
  4684.      * @see R.ifElse, R.when
  4685.      * @example
  4686.      *
  4687.      *      // coerceArray :: (a|[a]) -> [a]
  4688.      *      var coerceArray = R.unless(R.isArrayLike, R.of);
  4689.      *      coerceArray([1, 2, 3]); //=> [1, 2, 3]
  4690.      *      coerceArray(1);         //=> [1]
  4691.      */
  4692.     var unless = _curry3(function unless(pred, whenFalseFn, x) {
  4693.         return pred(x) ? x : whenFalseFn(x);
  4694.     });
  4695.  
  4696.     /**
  4697.      * Takes a predicate, a transformation function, and an initial value,
  4698.      * and returns a value of the same type as the initial value.
  4699.      * It does so by applying the transformation until the predicate is satisfied,
  4700.      * at which point it returns the satisfactory value.
  4701.      *
  4702.      * @func
  4703.      * @memberOf R
  4704.      * @since v0.20.0
  4705.      * @category Logic
  4706.      * @sig (a -> Boolean) -> (a -> a) -> a -> a
  4707.      * @param {Function} pred A predicate function
  4708.      * @param {Function} fn The iterator function
  4709.      * @param {*} init Initial value
  4710.      * @return {*} Final value that satisfies predicate
  4711.      * @example
  4712.      *
  4713.      *      R.until(R.gt(R.__, 100), R.multiply(2))(1) // => 128
  4714.      */
  4715.     var until = _curry3(function until(pred, fn, init) {
  4716.         var val = init;
  4717.         while (!pred(val)) {
  4718.             val = fn(val);
  4719.         }
  4720.         return val;
  4721.     });
  4722.  
  4723.     /**
  4724.      * Returns a new copy of the array with the element at the provided index
  4725.      * replaced with the given value.
  4726.      *
  4727.      * @func
  4728.      * @memberOf R
  4729.      * @since v0.14.0
  4730.      * @category List
  4731.      * @sig Number -> a -> [a] -> [a]
  4732.      * @param {Number} idx The index to update.
  4733.      * @param {*} x The value to exist at the given index of the returned array.
  4734.      * @param {Array|Arguments} list The source array-like object to be updated.
  4735.      * @return {Array} A copy of `list` with the value at index `idx` replaced with `x`.
  4736.      * @see R.adjust
  4737.      * @example
  4738.      *
  4739.      *      R.update(1, 11, [0, 1, 2]);     //=> [0, 11, 2]
  4740.      *      R.update(1)(11)([0, 1, 2]);     //=> [0, 11, 2]
  4741.      * @symb R.update(-1, a, [b, c]) = [b, a]
  4742.      * @symb R.update(0, a, [b, c]) = [a, c]
  4743.      * @symb R.update(1, a, [b, c]) = [b, a]
  4744.      */
  4745.     var update = _curry3(function update(idx, x, list) {
  4746.         return adjust(always(x), idx, list);
  4747.     });
  4748.  
  4749.     /**
  4750.      * Accepts a function `fn` and a list of transformer functions and returns a
  4751.      * new curried function. When the new function is invoked, it calls the
  4752.      * function `fn` with parameters consisting of the result of calling each
  4753.      * supplied handler on successive arguments to the new function.
  4754.      *
  4755.      * If more arguments are passed to the returned function than transformer
  4756.      * functions, those arguments are passed directly to `fn` as additional
  4757.      * parameters. If you expect additional arguments that don't need to be
  4758.      * transformed, although you can ignore them, it's best to pass an identity
  4759.      * function so that the new function reports the correct arity.
  4760.      *
  4761.      * @func
  4762.      * @memberOf R
  4763.      * @since v0.1.0
  4764.      * @category Function
  4765.      * @sig (x1 -> x2 -> ... -> z) -> [(a -> x1), (b -> x2), ...] -> (a -> b -> ... -> z)
  4766.      * @param {Function} fn The function to wrap.
  4767.      * @param {Array} transformers A list of transformer functions
  4768.      * @return {Function} The wrapped function.
  4769.      * @see R.converge
  4770.      * @example
  4771.      *
  4772.      *      R.useWith(Math.pow, [R.identity, R.identity])(3, 4); //=> 81
  4773.      *      R.useWith(Math.pow, [R.identity, R.identity])(3)(4); //=> 81
  4774.      *      R.useWith(Math.pow, [R.dec, R.inc])(3, 4); //=> 32
  4775.      *      R.useWith(Math.pow, [R.dec, R.inc])(3)(4); //=> 32
  4776.      * @symb R.useWith(f, [g, h])(a, b) = f(g(a), h(b))
  4777.      */
  4778.     var useWith = _curry2(function useWith(fn, transformers) {
  4779.         return curryN(transformers.length, function () {
  4780.             var args = [];
  4781.             var idx = 0;
  4782.             while (idx < transformers.length) {
  4783.                 args.push(transformers[idx].call(this, arguments[idx]));
  4784.                 idx += 1;
  4785.             }
  4786.             return fn.apply(this, args.concat(Array.prototype.slice.call(arguments, transformers.length)));
  4787.         });
  4788.     });
  4789.  
  4790.     /**
  4791.      * Returns a list of all the enumerable own properties of the supplied object.
  4792.      * Note that the order of the output array is not guaranteed across different
  4793.      * JS platforms.
  4794.      *
  4795.      * @func
  4796.      * @memberOf R
  4797.      * @since v0.1.0
  4798.      * @category Object
  4799.      * @sig {k: v} -> [v]
  4800.      * @param {Object} obj The object to extract values from
  4801.      * @return {Array} An array of the values of the object's own properties.
  4802.      * @example
  4803.      *
  4804.      *      R.values({a: 1, b: 2, c: 3}); //=> [1, 2, 3]
  4805.      */
  4806.     var values = _curry1(function values(obj) {
  4807.         var props = keys(obj);
  4808.         var len = props.length;
  4809.         var vals = [];
  4810.         var idx = 0;
  4811.         while (idx < len) {
  4812.             vals[idx] = obj[props[idx]];
  4813.             idx += 1;
  4814.         }
  4815.         return vals;
  4816.     });
  4817.  
  4818.     /**
  4819.      * Returns a list of all the properties, including prototype properties, of the
  4820.      * supplied object.
  4821.      * Note that the order of the output array is not guaranteed to be consistent
  4822.      * across different JS platforms.
  4823.      *
  4824.      * @func
  4825.      * @memberOf R
  4826.      * @since v0.2.0
  4827.      * @category Object
  4828.      * @sig {k: v} -> [v]
  4829.      * @param {Object} obj The object to extract values from
  4830.      * @return {Array} An array of the values of the object's own and prototype properties.
  4831.      * @example
  4832.      *
  4833.      *      var F = function() { this.x = 'X'; };
  4834.      *      F.prototype.y = 'Y';
  4835.      *      var f = new F();
  4836.      *      R.valuesIn(f); //=> ['X', 'Y']
  4837.      */
  4838.     var valuesIn = _curry1(function valuesIn(obj) {
  4839.         var prop;
  4840.         var vs = [];
  4841.         for (prop in obj) {
  4842.             vs[vs.length] = obj[prop];
  4843.         }
  4844.         return vs;
  4845.     });
  4846.  
  4847.     /**
  4848.      * Returns a "view" of the given data structure, determined by the given lens.
  4849.      * The lens's focus determines which portion of the data structure is visible.
  4850.      *
  4851.      * @func
  4852.      * @memberOf R
  4853.      * @since v0.16.0
  4854.      * @category Object
  4855.      * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
  4856.      * @sig Lens s a -> s -> a
  4857.      * @param {Lens} lens
  4858.      * @param {*} x
  4859.      * @return {*}
  4860.      * @see R.prop, R.lensIndex, R.lensProp
  4861.      * @example
  4862.      *
  4863.      *      var xLens = R.lensProp('x');
  4864.      *
  4865.      *      R.view(xLens, {x: 1, y: 2});  //=> 1
  4866.      *      R.view(xLens, {x: 4, y: 2});  //=> 4
  4867.      */
  4868.     // `Const` is a functor that effectively ignores the function given to `map`.
  4869.     // Using `Const` effectively ignores the setter function of the `lens`,
  4870.     // leaving the value returned by the getter function unmodified.
  4871.     var view = function () {
  4872.         // `Const` is a functor that effectively ignores the function given to `map`.
  4873.         var Const = function (x) {
  4874.             return {
  4875.                 value: x,
  4876.                 map: function () {
  4877.                     return this;
  4878.                 }
  4879.             };
  4880.         };
  4881.         return _curry2(function view(lens, x) {
  4882.             // Using `Const` effectively ignores the setter function of the `lens`,
  4883.             // leaving the value returned by the getter function unmodified.
  4884.             return lens(Const)(x).value;
  4885.         });
  4886.     }();
  4887.  
  4888.     /**
  4889.      * Tests the final argument by passing it to the given predicate function. If
  4890.      * the predicate is satisfied, the function will return the result of calling
  4891.      * the `whenTrueFn` function with the same argument. If the predicate is not
  4892.      * satisfied, the argument is returned as is.
  4893.      *
  4894.      * @func
  4895.      * @memberOf R
  4896.      * @since v0.18.0
  4897.      * @category Logic
  4898.      * @sig (a -> Boolean) -> (a -> a) -> a -> a
  4899.      * @param {Function} pred       A predicate function
  4900.      * @param {Function} whenTrueFn A function to invoke when the `condition`
  4901.      *                              evaluates to a truthy value.
  4902.      * @param {*}        x          An object to test with the `pred` function and
  4903.      *                              pass to `whenTrueFn` if necessary.
  4904.      * @return {*} Either `x` or the result of applying `x` to `whenTrueFn`.
  4905.      * @see R.ifElse, R.unless
  4906.      * @example
  4907.      *
  4908.      *      // truncate :: String -> String
  4909.      *      var truncate = R.when(
  4910.      *        R.propSatisfies(R.gt(R.__, 10), 'length'),
  4911.      *        R.pipe(R.take(10), R.append('�'), R.join(''))
  4912.      *      );
  4913.      *      truncate('12345');         //=> '12345'
  4914.      *      truncate('0123456789ABC'); //=> '0123456789�'
  4915.      */
  4916.     var when = _curry3(function when(pred, whenTrueFn, x) {
  4917.         return pred(x) ? whenTrueFn(x) : x;
  4918.     });
  4919.  
  4920.     /**
  4921.      * Takes a spec object and a test object; returns true if the test satisfies
  4922.      * the spec. Each of the spec's own properties must be a predicate function.
  4923.      * Each predicate is applied to the value of the corresponding property of the
  4924.      * test object. `where` returns true if all the predicates return true, false
  4925.      * otherwise.
  4926.      *
  4927.      * `where` is well suited to declaratively expressing constraints for other
  4928.      * functions such as `filter` and `find`.
  4929.      *
  4930.      * @func
  4931.      * @memberOf R
  4932.      * @since v0.1.1
  4933.      * @category Object
  4934.      * @sig {String: (* -> Boolean)} -> {String: *} -> Boolean
  4935.      * @param {Object} spec
  4936.      * @param {Object} testObj
  4937.      * @return {Boolean}
  4938.      * @example
  4939.      *
  4940.      *      // pred :: Object -> Boolean
  4941.      *      var pred = R.where({
  4942.      *        a: R.equals('foo'),
  4943.      *        b: R.complement(R.equals('bar')),
  4944.      *        x: R.gt(__, 10),
  4945.      *        y: R.lt(__, 20)
  4946.      *      });
  4947.      *
  4948.      *      pred({a: 'foo', b: 'xxx', x: 11, y: 19}); //=> true
  4949.      *      pred({a: 'xxx', b: 'xxx', x: 11, y: 19}); //=> false
  4950.      *      pred({a: 'foo', b: 'bar', x: 11, y: 19}); //=> false
  4951.      *      pred({a: 'foo', b: 'xxx', x: 10, y: 19}); //=> false
  4952.      *      pred({a: 'foo', b: 'xxx', x: 11, y: 20}); //=> false
  4953.      */
  4954.     var where = _curry2(function where(spec, testObj) {
  4955.         for (var prop in spec) {
  4956.             if (_has(prop, spec) && !spec[prop](testObj[prop])) {
  4957.                 return false;
  4958.             }
  4959.         }
  4960.         return true;
  4961.     });
  4962.  
  4963.     /**
  4964.      * Creates a new list out of the two supplied by creating each possible pair
  4965.      * from the lists.
  4966.      *
  4967.      * @func
  4968.      * @memberOf R
  4969.      * @since v0.1.0
  4970.      * @category List
  4971.      * @sig [a] -> [b] -> [[a,b]]
  4972.      * @param {Array} as The first list.
  4973.      * @param {Array} bs The second list.
  4974.      * @return {Array} The list made by combining each possible pair from
  4975.      *         `as` and `bs` into pairs (`[a, b]`).
  4976.      * @example
  4977.      *
  4978.      *      R.xprod([1, 2], ['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]
  4979.      * @symb R.xprod([a, b], [c, d]) = [[a, c], [a, d], [b, c], [b, d]]
  4980.      */
  4981.     // = xprodWith(prepend); (takes about 3 times as long...)
  4982.     var xprod = _curry2(function xprod(a, b) {
  4983.         // = xprodWith(prepend); (takes about 3 times as long...)
  4984.         var idx = 0;
  4985.         var ilen = a.length;
  4986.         var j;
  4987.         var jlen = b.length;
  4988.         var result = [];
  4989.         while (idx < ilen) {
  4990.             j = 0;
  4991.             while (j < jlen) {
  4992.                 result[result.length] = [
  4993.                     a[idx],
  4994.                     b[j]
  4995.                 ];
  4996.                 j += 1;
  4997.             }
  4998.             idx += 1;
  4999.         }
  5000.         return result;
  5001.     });
  5002.  
  5003.     /**
  5004.      * Creates a new list out of the two supplied by pairing up equally-positioned
  5005.      * items from both lists. The returned list is truncated to the length of the
  5006.      * shorter of the two input lists.
  5007.      * Note: `zip` is equivalent to `zipWith(function(a, b) { return [a, b] })`.
  5008.      *
  5009.      * @func
  5010.      * @memberOf R
  5011.      * @since v0.1.0
  5012.      * @category List
  5013.      * @sig [a] -> [b] -> [[a,b]]
  5014.      * @param {Array} list1 The first array to consider.
  5015.      * @param {Array} list2 The second array to consider.
  5016.      * @return {Array} The list made by pairing up same-indexed elements of `list1` and `list2`.
  5017.      * @example
  5018.      *
  5019.      *      R.zip([1, 2, 3], ['a', 'b', 'c']); //=> [[1, 'a'], [2, 'b'], [3, 'c']]
  5020.      * @symb R.zip([a, b, c], [d, e, f]) = [[a, d], [b, e], [c, f]]
  5021.      */
  5022.     var zip = _curry2(function zip(a, b) {
  5023.         var rv = [];
  5024.         var idx = 0;
  5025.         var len = Math.min(a.length, b.length);
  5026.         while (idx < len) {
  5027.             rv[idx] = [
  5028.                 a[idx],
  5029.                 b[idx]
  5030.             ];
  5031.             idx += 1;
  5032.         }
  5033.         return rv;
  5034.     });
  5035.  
  5036.     /**
  5037.      * Creates a new object out of a list of keys and a list of values.
  5038.      * Key/value pairing is truncated to the length of the shorter of the two lists.
  5039.      * Note: `zipObj` is equivalent to `pipe(zipWith(pair), fromPairs)`.
  5040.      *
  5041.      * @func
  5042.      * @memberOf R
  5043.      * @since v0.3.0
  5044.      * @category List
  5045.      * @sig [String] -> [*] -> {String: *}
  5046.      * @param {Array} keys The array that will be properties on the output object.
  5047.      * @param {Array} values The list of values on the output object.
  5048.      * @return {Object} The object made by pairing up same-indexed elements of `keys` and `values`.
  5049.      * @example
  5050.      *
  5051.      *      R.zipObj(['a', 'b', 'c'], [1, 2, 3]); //=> {a: 1, b: 2, c: 3}
  5052.      */
  5053.     var zipObj = _curry2(function zipObj(keys, values) {
  5054.         var idx = 0;
  5055.         var len = Math.min(keys.length, values.length);
  5056.         var out = {};
  5057.         while (idx < len) {
  5058.             out[keys[idx]] = values[idx];
  5059.             idx += 1;
  5060.         }
  5061.         return out;
  5062.     });
  5063.  
  5064.     /**
  5065.      * Creates a new list out of the two supplied by applying the function to each
  5066.      * equally-positioned pair in the lists. The returned list is truncated to the
  5067.      * length of the shorter of the two input lists.
  5068.      *
  5069.      * @function
  5070.      * @memberOf R
  5071.      * @since v0.1.0
  5072.      * @category List
  5073.      * @sig (a,b -> c) -> [a] -> [b] -> [c]
  5074.      * @param {Function} fn The function used to combine the two elements into one value.
  5075.      * @param {Array} list1 The first array to consider.
  5076.      * @param {Array} list2 The second array to consider.
  5077.      * @return {Array} The list made by combining same-indexed elements of `list1` and `list2`
  5078.      *         using `fn`.
  5079.      * @example
  5080.      *
  5081.      *      var f = (x, y) => {
  5082.      *        // ...
  5083.      *      };
  5084.      *      R.zipWith(f, [1, 2, 3], ['a', 'b', 'c']);
  5085.      *      //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')]
  5086.      * @symb R.zipWith(fn, [a, b, c], [d, e, f]) = [fn(a, d), fn(b, e), fn(c, f)]
  5087.      */
  5088.     var zipWith = _curry3(function zipWith(fn, a, b) {
  5089.         var rv = [];
  5090.         var idx = 0;
  5091.         var len = Math.min(a.length, b.length);
  5092.         while (idx < len) {
  5093.             rv[idx] = fn(a[idx], b[idx]);
  5094.             idx += 1;
  5095.         }
  5096.         return rv;
  5097.     });
  5098.  
  5099.     /**
  5100.      * A function that always returns `false`. Any passed in parameters are ignored.
  5101.      *
  5102.      * @func
  5103.      * @memberOf R
  5104.      * @since v0.9.0
  5105.      * @category Function
  5106.      * @sig * -> Boolean
  5107.      * @param {*}
  5108.      * @return {Boolean}
  5109.      * @see R.always, R.T
  5110.      * @example
  5111.      *
  5112.      *      R.F(); //=> false
  5113.      */
  5114.     var F = always(false);
  5115.  
  5116.     /**
  5117.      * A function that always returns `true`. Any passed in parameters are ignored.
  5118.      *
  5119.      * @func
  5120.      * @memberOf R
  5121.      * @since v0.9.0
  5122.      * @category Function
  5123.      * @sig * -> Boolean
  5124.      * @param {*}
  5125.      * @return {Boolean}
  5126.      * @see R.always, R.F
  5127.      * @example
  5128.      *
  5129.      *      R.T(); //=> true
  5130.      */
  5131.     var T = always(true);
  5132.  
  5133.     /**
  5134.      * Copies an object.
  5135.      *
  5136.      * @private
  5137.      * @param {*} value The value to be copied
  5138.      * @param {Array} refFrom Array containing the source references
  5139.      * @param {Array} refTo Array containing the copied source references
  5140.      * @param {Boolean} deep Whether or not to perform deep cloning.
  5141.      * @return {*} The copied value.
  5142.      */
  5143.     var _clone = function _clone(value, refFrom, refTo, deep) {
  5144.         var copy = function copy(copiedValue) {
  5145.             var len = refFrom.length;
  5146.             var idx = 0;
  5147.             while (idx < len) {
  5148.                 if (value === refFrom[idx]) {
  5149.                     return refTo[idx];
  5150.                 }
  5151.                 idx += 1;
  5152.             }
  5153.             refFrom[idx + 1] = value;
  5154.             refTo[idx + 1] = copiedValue;
  5155.             for (var key in value) {
  5156.                 copiedValue[key] = deep ? _clone(value[key], refFrom, refTo, true) : value[key];
  5157.             }
  5158.             return copiedValue;
  5159.         };
  5160.         switch (type(value)) {
  5161.         case 'Object':
  5162.             return copy({});
  5163.         case 'Array':
  5164.             return copy([]);
  5165.         case 'Date':
  5166.             return new Date(value.valueOf());
  5167.         case 'RegExp':
  5168.             return _cloneRegExp(value);
  5169.         default:
  5170.             return value;
  5171.         }
  5172.     };
  5173.  
  5174.     var _createPartialApplicator = function _createPartialApplicator(concat) {
  5175.         return _curry2(function (fn, args) {
  5176.             return _arity(Math.max(0, fn.length - args.length), function () {
  5177.                 return fn.apply(this, concat(args, arguments));
  5178.             });
  5179.         });
  5180.     };
  5181.  
  5182.     var _dropLast = function dropLast(n, xs) {
  5183.         return take(n < xs.length ? xs.length - n : 0, xs);
  5184.     };
  5185.  
  5186.     // Values of other types are only equal if identical.
  5187.     var _equals = function _equals(a, b, stackA, stackB) {
  5188.         if (identical(a, b)) {
  5189.             return true;
  5190.         }
  5191.         if (type(a) !== type(b)) {
  5192.             return false;
  5193.         }
  5194.         if (a == null || b == null) {
  5195.             return false;
  5196.         }
  5197.         if (typeof a.equals === 'function' || typeof b.equals === 'function') {
  5198.             return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a);
  5199.         }
  5200.         switch (type(a)) {
  5201.         case 'Arguments':
  5202.         case 'Array':
  5203.         case 'Object':
  5204.             if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') {
  5205.                 return a === b;
  5206.             }
  5207.             break;
  5208.         case 'Boolean':
  5209.         case 'Number':
  5210.         case 'String':
  5211.             if (!(typeof a === typeof b && identical(a.valueOf(), b.valueOf()))) {
  5212.                 return false;
  5213.             }
  5214.             break;
  5215.         case 'Date':
  5216.             if (!identical(a.valueOf(), b.valueOf())) {
  5217.                 return false;
  5218.             }
  5219.             break;
  5220.         case 'Error':
  5221.             return a.name === b.name && a.message === b.message;
  5222.         case 'RegExp':
  5223.             if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) {
  5224.                 return false;
  5225.             }
  5226.             break;
  5227.         case 'Map':
  5228.         case 'Set':
  5229.             if (!_equals(_arrayFromIterator(a.entries()), _arrayFromIterator(b.entries()), stackA, stackB)) {
  5230.                 return false;
  5231.             }
  5232.             break;
  5233.         case 'Int8Array':
  5234.         case 'Uint8Array':
  5235.         case 'Uint8ClampedArray':
  5236.         case 'Int16Array':
  5237.         case 'Uint16Array':
  5238.         case 'Int32Array':
  5239.         case 'Uint32Array':
  5240.         case 'Float32Array':
  5241.         case 'Float64Array':
  5242.             break;
  5243.         case 'ArrayBuffer':
  5244.             break;
  5245.         default:
  5246.             // Values of other types are only equal if identical.
  5247.             return false;
  5248.         }
  5249.         var keysA = keys(a);
  5250.         if (keysA.length !== keys(b).length) {
  5251.             return false;
  5252.         }
  5253.         var idx = stackA.length - 1;
  5254.         while (idx >= 0) {
  5255.             if (stackA[idx] === a) {
  5256.                 return stackB[idx] === b;
  5257.             }
  5258.             idx -= 1;
  5259.         }
  5260.         stackA.push(a);
  5261.         stackB.push(b);
  5262.         idx = keysA.length - 1;
  5263.         while (idx >= 0) {
  5264.             var key = keysA[idx];
  5265.             if (!(_has(key, b) && _equals(b[key], a[key], stackA, stackB))) {
  5266.                 return false;
  5267.             }
  5268.             idx -= 1;
  5269.         }
  5270.         stackA.pop();
  5271.         stackB.pop();
  5272.         return true;
  5273.     };
  5274.  
  5275.     /**
  5276.      * `_makeFlat` is a helper function that returns a one-level or fully recursive
  5277.      * function based on the flag passed in.
  5278.      *
  5279.      * @private
  5280.      */
  5281.     var _makeFlat = function _makeFlat(recursive) {
  5282.         return function flatt(list) {
  5283.             var value, jlen, j;
  5284.             var result = [];
  5285.             var idx = 0;
  5286.             var ilen = list.length;
  5287.             while (idx < ilen) {
  5288.                 if (isArrayLike(list[idx])) {
  5289.                     value = recursive ? flatt(list[idx]) : list[idx];
  5290.                     j = 0;
  5291.                     jlen = value.length;
  5292.                     while (j < jlen) {
  5293.                         result[result.length] = value[j];
  5294.                         j += 1;
  5295.                     }
  5296.                 } else {
  5297.                     result[result.length] = list[idx];
  5298.                 }
  5299.                 idx += 1;
  5300.             }
  5301.             return result;
  5302.         };
  5303.     };
  5304.  
  5305.     var _reduce = function () {
  5306.         function _arrayReduce(xf, acc, list) {
  5307.             var idx = 0;
  5308.             var len = list.length;
  5309.             while (idx < len) {
  5310.                 acc = xf['@@transducer/step'](acc, list[idx]);
  5311.                 if (acc && acc['@@transducer/reduced']) {
  5312.                     acc = acc['@@transducer/value'];
  5313.                     break;
  5314.                 }
  5315.                 idx += 1;
  5316.             }
  5317.             return xf['@@transducer/result'](acc);
  5318.         }
  5319.         function _iterableReduce(xf, acc, iter) {
  5320.             var step = iter.next();
  5321.             while (!step.done) {
  5322.                 acc = xf['@@transducer/step'](acc, step.value);
  5323.                 if (acc && acc['@@transducer/reduced']) {
  5324.                     acc = acc['@@transducer/value'];
  5325.                     break;
  5326.                 }
  5327.                 step = iter.next();
  5328.             }
  5329.             return xf['@@transducer/result'](acc);
  5330.         }
  5331.         function _methodReduce(xf, acc, obj) {
  5332.             return xf['@@transducer/result'](obj.reduce(bind(xf['@@transducer/step'], xf), acc));
  5333.         }
  5334.         var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';
  5335.         return function _reduce(fn, acc, list) {
  5336.             if (typeof fn === 'function') {
  5337.                 fn = _xwrap(fn);
  5338.             }
  5339.             if (isArrayLike(list)) {
  5340.                 return _arrayReduce(fn, acc, list);
  5341.             }
  5342.             if (typeof list.reduce === 'function') {
  5343.                 return _methodReduce(fn, acc, list);
  5344.             }
  5345.             if (list[symIterator] != null) {
  5346.                 return _iterableReduce(fn, acc, list[symIterator]());
  5347.             }
  5348.             if (typeof list.next === 'function') {
  5349.                 return _iterableReduce(fn, acc, list);
  5350.             }
  5351.             throw new TypeError('reduce: list must be array or iterable');
  5352.         };
  5353.     }();
  5354.  
  5355.     var _stepCat = function () {
  5356.         var _stepCatArray = {
  5357.             '@@transducer/init': Array,
  5358.             '@@transducer/step': function (xs, x) {
  5359.                 xs.push(x);
  5360.                 return xs;
  5361.             },
  5362.             '@@transducer/result': _identity
  5363.         };
  5364.         var _stepCatString = {
  5365.             '@@transducer/init': String,
  5366.             '@@transducer/step': function (a, b) {
  5367.                 return a + b;
  5368.             },
  5369.             '@@transducer/result': _identity
  5370.         };
  5371.         var _stepCatObject = {
  5372.             '@@transducer/init': Object,
  5373.             '@@transducer/step': function (result, input) {
  5374.                 return _assign(result, isArrayLike(input) ? objOf(input[0], input[1]) : input);
  5375.             },
  5376.             '@@transducer/result': _identity
  5377.         };
  5378.         return function _stepCat(obj) {
  5379.             if (_isTransformer(obj)) {
  5380.                 return obj;
  5381.             }
  5382.             if (isArrayLike(obj)) {
  5383.                 return _stepCatArray;
  5384.             }
  5385.             if (typeof obj === 'string') {
  5386.                 return _stepCatString;
  5387.             }
  5388.             if (typeof obj === 'object') {
  5389.                 return _stepCatObject;
  5390.             }
  5391.             throw new Error('Cannot create transformer for ' + obj);
  5392.         };
  5393.     }();
  5394.  
  5395.     var _xdropLastWhile = function () {
  5396.         function XDropLastWhile(fn, xf) {
  5397.             this.f = fn;
  5398.             this.retained = [];
  5399.             this.xf = xf;
  5400.         }
  5401.         XDropLastWhile.prototype['@@transducer/init'] = _xfBase.init;
  5402.         XDropLastWhile.prototype['@@transducer/result'] = function (result) {
  5403.             this.retained = null;
  5404.             return this.xf['@@transducer/result'](result);
  5405.         };
  5406.         XDropLastWhile.prototype['@@transducer/step'] = function (result, input) {
  5407.             return this.f(input) ? this.retain(result, input) : this.flush(result, input);
  5408.         };
  5409.         XDropLastWhile.prototype.flush = function (result, input) {
  5410.             result = _reduce(this.xf['@@transducer/step'], result, this.retained);
  5411.             this.retained = [];
  5412.             return this.xf['@@transducer/step'](result, input);
  5413.         };
  5414.         XDropLastWhile.prototype.retain = function (result, input) {
  5415.             this.retained.push(input);
  5416.             return result;
  5417.         };
  5418.         return _curry2(function _xdropLastWhile(fn, xf) {
  5419.             return new XDropLastWhile(fn, xf);
  5420.         });
  5421.     }();
  5422.  
  5423.     /**
  5424.      * Creates a new list iteration function from an existing one by adding two new
  5425.      * parameters to its callback function: the current index, and the entire list.
  5426.      *
  5427.      * This would turn, for instance, Ramda's simple `map` function into one that
  5428.      * more closely resembles `Array.prototype.map`. Note that this will only work
  5429.      * for functions in which the iteration callback function is the first
  5430.      * parameter, and where the list is the last parameter. (This latter might be
  5431.      * unimportant if the list parameter is not used.)
  5432.      *
  5433.      * @func
  5434.      * @memberOf R
  5435.      * @since v0.15.0
  5436.      * @category Function
  5437.      * @category List
  5438.      * @sig ((a ... -> b) ... -> [a] -> *) -> (a ..., Int, [a] -> b) ... -> [a] -> *)
  5439.      * @param {Function} fn A list iteration function that does not pass index or list to its callback
  5440.      * @return {Function} An altered list iteration function that passes (item, index, list) to its callback
  5441.      * @example
  5442.      *
  5443.      *      var mapIndexed = R.addIndex(R.map);
  5444.      *      mapIndexed((val, idx) => idx + '-' + val, ['f', 'o', 'o', 'b', 'a', 'r']);
  5445.      *      //=> ['0-f', '1-o', '2-o', '3-b', '4-a', '5-r']
  5446.      */
  5447.     var addIndex = _curry1(function addIndex(fn) {
  5448.         return curryN(fn.length, function () {
  5449.             var idx = 0;
  5450.             var origFn = arguments[0];
  5451.             var list = arguments[arguments.length - 1];
  5452.             var args = Array.prototype.slice.call(arguments, 0);
  5453.             args[0] = function () {
  5454.                 var result = origFn.apply(this, _concat(arguments, [
  5455.                     idx,
  5456.                     list
  5457.                 ]));
  5458.                 idx += 1;
  5459.                 return result;
  5460.             };
  5461.             return fn.apply(this, args);
  5462.         });
  5463.     });
  5464.  
  5465.     /**
  5466.      * Wraps a function of any arity (including nullary) in a function that accepts
  5467.      * exactly 2 parameters. Any extraneous parameters will not be passed to the
  5468.      * supplied function.
  5469.      *
  5470.      * @func
  5471.      * @memberOf R
  5472.      * @since v0.2.0
  5473.      * @category Function
  5474.      * @sig (* -> c) -> (a, b -> c)
  5475.      * @param {Function} fn The function to wrap.
  5476.      * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of
  5477.      *         arity 2.
  5478.      * @example
  5479.      *
  5480.      *      var takesThreeArgs = function(a, b, c) {
  5481.      *        return [a, b, c];
  5482.      *      };
  5483.      *      takesThreeArgs.length; //=> 3
  5484.      *      takesThreeArgs(1, 2, 3); //=> [1, 2, 3]
  5485.      *
  5486.      *      var takesTwoArgs = R.binary(takesThreeArgs);
  5487.      *      takesTwoArgs.length; //=> 2
  5488.      *      // Only 2 arguments are passed to the wrapped function
  5489.      *      takesTwoArgs(1, 2, 3); //=> [1, 2, undefined]
  5490.      * @symb R.binary(f)(a, b, c) = f(a, b)
  5491.      */
  5492.     var binary = _curry1(function binary(fn) {
  5493.         return nAry(2, fn);
  5494.     });
  5495.  
  5496.     /**
  5497.      * Creates a deep copy of the value which may contain (nested) `Array`s and
  5498.      * `Object`s, `Number`s, `String`s, `Boolean`s and `Date`s. `Function`s are
  5499.      * assigned by reference rather than copied
  5500.      *
  5501.      * Dispatches to a `clone` method if present.
  5502.      *
  5503.      * @func
  5504.      * @memberOf R
  5505.      * @since v0.1.0
  5506.      * @category Object
  5507.      * @sig {*} -> {*}
  5508.      * @param {*} value The object or array to clone
  5509.      * @return {*} A deeply cloned copy of `val`
  5510.      * @example
  5511.      *
  5512.      *      var objects = [{}, {}, {}];
  5513.      *      var objectsClone = R.clone(objects);
  5514.      *      objects === objectsClone; //=> false
  5515.      *      objects[0] === objectsClone[0]; //=> false
  5516.      */
  5517.     var clone = _curry1(function clone(value) {
  5518.         return value != null && typeof value.clone === 'function' ? value.clone() : _clone(value, [], [], true);
  5519.     });
  5520.  
  5521.     /**
  5522.      * Returns a curried equivalent of the provided function. The curried function
  5523.      * has two unusual capabilities. First, its arguments needn't be provided one
  5524.      * at a time. If `f` is a ternary function and `g` is `R.curry(f)`, the
  5525.      * following are equivalent:
  5526.      *
  5527.      *   - `g(1)(2)(3)`
  5528.      *   - `g(1)(2, 3)`
  5529.      *   - `g(1, 2)(3)`
  5530.      *   - `g(1, 2, 3)`
  5531.      *
  5532.      * Secondly, the special placeholder value `R.__` may be used to specify
  5533.      * "gaps", allowing partial application of any combination of arguments,
  5534.      * regardless of their positions. If `g` is as above and `_` is `R.__`, the
  5535.      * following are equivalent:
  5536.      *
  5537.      *   - `g(1, 2, 3)`
  5538.      *   - `g(_, 2, 3)(1)`
  5539.      *   - `g(_, _, 3)(1)(2)`
  5540.      *   - `g(_, _, 3)(1, 2)`
  5541.      *   - `g(_, 2)(1)(3)`
  5542.      *   - `g(_, 2)(1, 3)`
  5543.      *   - `g(_, 2)(_, 3)(1)`
  5544.      *
  5545.      * @func
  5546.      * @memberOf R
  5547.      * @since v0.1.0
  5548.      * @category Function
  5549.      * @sig (* -> a) -> (* -> a)
  5550.      * @param {Function} fn The function to curry.
  5551.      * @return {Function} A new, curried function.
  5552.      * @see R.curryN
  5553.      * @example
  5554.      *
  5555.      *      var addFourNumbers = (a, b, c, d) => a + b + c + d;
  5556.      *
  5557.      *      var curriedAddFourNumbers = R.curry(addFourNumbers);
  5558.      *      var f = curriedAddFourNumbers(1, 2);
  5559.      *      var g = f(3);
  5560.      *      g(4); //=> 10
  5561.      */
  5562.     var curry = _curry1(function curry(fn) {
  5563.         return curryN(fn.length, fn);
  5564.     });
  5565.  
  5566.     /**
  5567.      * Returns all but the first `n` elements of the given list, string, or
  5568.      * transducer/transformer (or object with a `drop` method).
  5569.      *
  5570.      * Dispatches to the `drop` method of the second argument, if present.
  5571.      *
  5572.      * @func
  5573.      * @memberOf R
  5574.      * @since v0.1.0
  5575.      * @category List
  5576.      * @sig Number -> [a] -> [a]
  5577.      * @sig Number -> String -> String
  5578.      * @param {Number} n
  5579.      * @param {[a]} list
  5580.      * @return {[a]} A copy of list without the first `n` elements
  5581.      * @see R.take, R.transduce, R.dropLast, R.dropWhile
  5582.      * @example
  5583.      *
  5584.      *      R.drop(1, ['foo', 'bar', 'baz']); //=> ['bar', 'baz']
  5585.      *      R.drop(2, ['foo', 'bar', 'baz']); //=> ['baz']
  5586.      *      R.drop(3, ['foo', 'bar', 'baz']); //=> []
  5587.      *      R.drop(4, ['foo', 'bar', 'baz']); //=> []
  5588.      *      R.drop(3, 'ramda');               //=> 'da'
  5589.      */
  5590.     var drop = _curry2(_dispatchable(['drop'], _xdrop, function drop(n, xs) {
  5591.         return slice(Math.max(0, n), Infinity, xs);
  5592.     }));
  5593.  
  5594.     /**
  5595.      * Returns a list containing all but the last `n` elements of the given `list`.
  5596.      *
  5597.      * @func
  5598.      * @memberOf R
  5599.      * @since v0.16.0
  5600.      * @category List
  5601.      * @sig Number -> [a] -> [a]
  5602.      * @sig Number -> String -> String
  5603.      * @param {Number} n The number of elements of `list` to skip.
  5604.      * @param {Array} list The list of elements to consider.
  5605.      * @return {Array} A copy of the list with only the first `list.length - n` elements
  5606.      * @see R.takeLast, R.drop, R.dropWhile, R.dropLastWhile
  5607.      * @example
  5608.      *
  5609.      *      R.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']
  5610.      *      R.dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo']
  5611.      *      R.dropLast(3, ['foo', 'bar', 'baz']); //=> []
  5612.      *      R.dropLast(4, ['foo', 'bar', 'baz']); //=> []
  5613.      *      R.dropLast(3, 'ramda');               //=> 'ra'
  5614.      */
  5615.     var dropLast = _curry2(_dispatchable([], _xdropLast, _dropLast));
  5616.  
  5617.     /**
  5618.      * Returns a new list excluding all the tailing elements of a given list which
  5619.      * satisfy the supplied predicate function. It passes each value from the right
  5620.      * to the supplied predicate function, skipping elements until the predicate
  5621.      * function returns a `falsy` value. The predicate function is applied to one argument:
  5622.      * *(value)*.
  5623.      *
  5624.      * @func
  5625.      * @memberOf R
  5626.      * @since v0.16.0
  5627.      * @category List
  5628.      * @sig (a -> Boolean) -> [a] -> [a]
  5629.      * @param {Function} predicate The function to be called on each element
  5630.      * @param {Array} list The collection to iterate over.
  5631.      * @return {Array} A new array without any trailing elements that return `falsy` values from the `predicate`.
  5632.      * @see R.takeLastWhile, R.addIndex, R.drop, R.dropWhile
  5633.      * @example
  5634.      *
  5635.      *      var lteThree = x => x <= 3;
  5636.      *
  5637.      *      R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4]
  5638.      */
  5639.     var dropLastWhile = _curry2(_dispatchable([], _xdropLastWhile, _dropLastWhile));
  5640.  
  5641.     /**
  5642.      * Returns `true` if its arguments are equivalent, `false` otherwise. Handles
  5643.      * cyclical data structures.
  5644.      *
  5645.      * Dispatches symmetrically to the `equals` methods of both arguments, if
  5646.      * present.
  5647.      *
  5648.      * @func
  5649.      * @memberOf R
  5650.      * @since v0.15.0
  5651.      * @category Relation
  5652.      * @sig a -> b -> Boolean
  5653.      * @param {*} a
  5654.      * @param {*} b
  5655.      * @return {Boolean}
  5656.      * @example
  5657.      *
  5658.      *      R.equals(1, 1); //=> true
  5659.      *      R.equals(1, '1'); //=> false
  5660.      *      R.equals([1, 2, 3], [1, 2, 3]); //=> true
  5661.      *
  5662.      *      var a = {}; a.v = a;
  5663.      *      var b = {}; b.v = b;
  5664.      *      R.equals(a, b); //=> true
  5665.      */
  5666.     var equals = _curry2(function equals(a, b) {
  5667.         return _equals(a, b, [], []);
  5668.     });
  5669.  
  5670.     /**
  5671.      * Takes a predicate and a "filterable", and returns a new filterable of the
  5672.      * same type containing the members of the given filterable which satisfy the
  5673.      * given predicate.
  5674.      *
  5675.      * Dispatches to the `filter` method of the second argument, if present.
  5676.      *
  5677.      * Acts as a transducer if a transformer is given in list position.
  5678.      *
  5679.      * @func
  5680.      * @memberOf R
  5681.      * @since v0.1.0
  5682.      * @category List
  5683.      * @sig Filterable f => (a -> Boolean) -> f a -> f a
  5684.      * @param {Function} pred
  5685.      * @param {Array} filterable
  5686.      * @return {Array}
  5687.      * @see R.reject, R.transduce, R.addIndex
  5688.      * @example
  5689.      *
  5690.      *      var isEven = n => n % 2 === 0;
  5691.      *
  5692.      *      R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4]
  5693.      *
  5694.      *      R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}
  5695.      */
  5696.     // else
  5697.     var filter = _curry2(_dispatchable(['filter'], _xfilter, function (pred, filterable) {
  5698.         return _isObject(filterable) ? _reduce(function (acc, key) {
  5699.             if (pred(filterable[key])) {
  5700.                 acc[key] = filterable[key];
  5701.             }
  5702.             return acc;
  5703.         }, {}, keys(filterable)) : // else
  5704.         _filter(pred, filterable);
  5705.     }));
  5706.  
  5707.     /**
  5708.      * Returns a new list by pulling every item out of it (and all its sub-arrays)
  5709.      * and putting them in a new array, depth-first.
  5710.      *
  5711.      * @func
  5712.      * @memberOf R
  5713.      * @since v0.1.0
  5714.      * @category List
  5715.      * @sig [a] -> [b]
  5716.      * @param {Array} list The array to consider.
  5717.      * @return {Array} The flattened list.
  5718.      * @see R.unnest
  5719.      * @example
  5720.      *
  5721.      *      R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]);
  5722.      *      //=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
  5723.      */
  5724.     var flatten = _curry1(_makeFlat(true));
  5725.  
  5726.     /**
  5727.      * Returns a new function much like the supplied one, except that the first two
  5728.      * arguments' order is reversed.
  5729.      *
  5730.      * @func
  5731.      * @memberOf R
  5732.      * @since v0.1.0
  5733.      * @category Function
  5734.      * @sig (a -> b -> c -> ... -> z) -> (b -> a -> c -> ... -> z)
  5735.      * @param {Function} fn The function to invoke with its first two parameters reversed.
  5736.      * @return {*} The result of invoking `fn` with its first two parameters' order reversed.
  5737.      * @example
  5738.      *
  5739.      *      var mergeThree = (a, b, c) => [].concat(a, b, c);
  5740.      *
  5741.      *      mergeThree(1, 2, 3); //=> [1, 2, 3]
  5742.      *
  5743.      *      R.flip(mergeThree)(1, 2, 3); //=> [2, 1, 3]
  5744.      * @symb R.flip(f)(a, b, c) = f(b, a, c)
  5745.      */
  5746.     var flip = _curry1(function flip(fn) {
  5747.         return curry(function (a, b) {
  5748.             var args = Array.prototype.slice.call(arguments, 0);
  5749.             args[0] = b;
  5750.             args[1] = a;
  5751.             return fn.apply(this, args);
  5752.         });
  5753.     });
  5754.  
  5755.     /**
  5756.      * Iterate over an input `object`, calling a provided function `fn` for each
  5757.      * key and value in the object.
  5758.      *
  5759.      * `fn` receives three argument: *(value, key, obj)*.
  5760.      *
  5761.      * @func
  5762.      * @memberOf R
  5763.      * @since v0.23.0
  5764.      * @category Object
  5765.      * @sig ((a, String, StrMap a) -> Any) -> StrMap a -> StrMap a
  5766.      * @param {Function} fn The function to invoke. Receives three argument, `value`, `key`, `obj`.
  5767.      * @param {Object} obj The object to iterate over.
  5768.      * @return {Object} The original object.
  5769.      * @example
  5770.      *
  5771.      *      var printKeyConcatValue = (value, key) => console.log(key + ':' + value);
  5772.      *      R.forEachObjIndexed(printKeyConcatValue, {x: 1, y: 2}); //=> {x: 1, y: 2}
  5773.      *      // logs x:1
  5774.      *      // logs y:2
  5775.      * @symb R.forEachObjIndexed(f, {x: a, y: b}) = {x: a, y: b}
  5776.      */
  5777.     var forEachObjIndexed = _curry2(function forEachObjIndexed(fn, obj) {
  5778.         var keyList = keys(obj);
  5779.         var idx = 0;
  5780.         while (idx < keyList.length) {
  5781.             var key = keyList[idx];
  5782.             fn(obj[key], key, obj);
  5783.             idx += 1;
  5784.         }
  5785.         return obj;
  5786.     });
  5787.  
  5788.     /**
  5789.      * Returns the first element of the given list or string. In some libraries
  5790.      * this function is named `first`.
  5791.      *
  5792.      * @func
  5793.      * @memberOf R
  5794.      * @since v0.1.0
  5795.      * @category List
  5796.      * @sig [a] -> a | Undefined
  5797.      * @sig String -> String
  5798.      * @param {Array|String} list
  5799.      * @return {*}
  5800.      * @see R.tail, R.init, R.last
  5801.      * @example
  5802.      *
  5803.      *      R.head(['fi', 'fo', 'fum']); //=> 'fi'
  5804.      *      R.head([]); //=> undefined
  5805.      *
  5806.      *      R.head('abc'); //=> 'a'
  5807.      *      R.head(''); //=> ''
  5808.      */
  5809.     var head = nth(0);
  5810.  
  5811.     /**
  5812.      * Returns all but the last element of the given list or string.
  5813.      *
  5814.      * @func
  5815.      * @memberOf R
  5816.      * @since v0.9.0
  5817.      * @category List
  5818.      * @sig [a] -> [a]
  5819.      * @sig String -> String
  5820.      * @param {*} list
  5821.      * @return {*}
  5822.      * @see R.last, R.head, R.tail
  5823.      * @example
  5824.      *
  5825.      *      R.init([1, 2, 3]);  //=> [1, 2]
  5826.      *      R.init([1, 2]);     //=> [1]
  5827.      *      R.init([1]);        //=> []
  5828.      *      R.init([]);         //=> []
  5829.      *
  5830.      *      R.init('abc');  //=> 'ab'
  5831.      *      R.init('ab');   //=> 'a'
  5832.      *      R.init('a');    //=> ''
  5833.      *      R.init('');     //=> ''
  5834.      */
  5835.     var init = slice(0, -1);
  5836.  
  5837.     /**
  5838.      * Combines two lists into a set (i.e. no duplicates) composed of those
  5839.      * elements common to both lists. Duplication is determined according to the
  5840.      * value returned by applying the supplied predicate to two list elements.
  5841.      *
  5842.      * @func
  5843.      * @memberOf R
  5844.      * @since v0.1.0
  5845.      * @category Relation
  5846.      * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a]
  5847.      * @param {Function} pred A predicate function that determines whether
  5848.      *        the two supplied elements are equal.
  5849.      * @param {Array} list1 One list of items to compare
  5850.      * @param {Array} list2 A second list of items to compare
  5851.      * @return {Array} A new list containing those elements common to both lists.
  5852.      * @see R.intersection
  5853.      * @example
  5854.      *
  5855.      *      var buffaloSpringfield = [
  5856.      *        {id: 824, name: 'Richie Furay'},
  5857.      *        {id: 956, name: 'Dewey Martin'},
  5858.      *        {id: 313, name: 'Bruce Palmer'},
  5859.      *        {id: 456, name: 'Stephen Stills'},
  5860.      *        {id: 177, name: 'Neil Young'}
  5861.      *      ];
  5862.      *      var csny = [
  5863.      *        {id: 204, name: 'David Crosby'},
  5864.      *        {id: 456, name: 'Stephen Stills'},
  5865.      *        {id: 539, name: 'Graham Nash'},
  5866.      *        {id: 177, name: 'Neil Young'}
  5867.      *      ];
  5868.      *
  5869.      *      R.intersectionWith(R.eqBy(R.prop('id')), buffaloSpringfield, csny);
  5870.      *      //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}]
  5871.      */
  5872.     var intersectionWith = _curry3(function intersectionWith(pred, list1, list2) {
  5873.         var lookupList, filteredList;
  5874.         if (list1.length > list2.length) {
  5875.             lookupList = list1;
  5876.             filteredList = list2;
  5877.         } else {
  5878.             lookupList = list2;
  5879.             filteredList = list1;
  5880.         }
  5881.         var results = [];
  5882.         var idx = 0;
  5883.         while (idx < filteredList.length) {
  5884.             if (_containsWith(pred, filteredList[idx], lookupList)) {
  5885.                 results[results.length] = filteredList[idx];
  5886.             }
  5887.             idx += 1;
  5888.         }
  5889.         return uniqWith(pred, results);
  5890.     });
  5891.  
  5892.     /**
  5893.      * Transforms the items of the list with the transducer and appends the
  5894.      * transformed items to the accumulator using an appropriate iterator function
  5895.      * based on the accumulator type.
  5896.      *
  5897.      * The accumulator can be an array, string, object or a transformer. Iterated
  5898.      * items will be appended to arrays and concatenated to strings. Objects will
  5899.      * be merged directly or 2-item arrays will be merged as key, value pairs.
  5900.      *
  5901.      * The accumulator can also be a transformer object that provides a 2-arity
  5902.      * reducing iterator function, step, 0-arity initial value function, init, and
  5903.      * 1-arity result extraction function result. The step function is used as the
  5904.      * iterator function in reduce. The result function is used to convert the
  5905.      * final accumulator into the return type and in most cases is R.identity. The
  5906.      * init function is used to provide the initial accumulator.
  5907.      *
  5908.      * The iteration is performed with R.reduce after initializing the transducer.
  5909.      *
  5910.      * @func
  5911.      * @memberOf R
  5912.      * @since v0.12.0
  5913.      * @category List
  5914.      * @sig a -> (b -> b) -> [c] -> a
  5915.      * @param {*} acc The initial accumulator value.
  5916.      * @param {Function} xf The transducer function. Receives a transformer and returns a transformer.
  5917.      * @param {Array} list The list to iterate over.
  5918.      * @return {*} The final, accumulated value.
  5919.      * @example
  5920.      *
  5921.      *      var numbers = [1, 2, 3, 4];
  5922.      *      var transducer = R.compose(R.map(R.add(1)), R.take(2));
  5923.      *
  5924.      *      R.into([], transducer, numbers); //=> [2, 3]
  5925.      *
  5926.      *      var intoArray = R.into([]);
  5927.      *      intoArray(transducer, numbers); //=> [2, 3]
  5928.      */
  5929.     var into = _curry3(function into(acc, xf, list) {
  5930.         return _isTransformer(acc) ? _reduce(xf(acc), acc['@@transducer/init'](), list) : _reduce(xf(_stepCat(acc)), _clone(acc, [], [], false), list);
  5931.     });
  5932.  
  5933.     /**
  5934.      * Same as R.invertObj, however this accounts for objects with duplicate values
  5935.      * by putting the values into an array.
  5936.      *
  5937.      * @func
  5938.      * @memberOf R
  5939.      * @since v0.9.0
  5940.      * @category Object
  5941.      * @sig {s: x} -> {x: [ s, ... ]}
  5942.      * @param {Object} obj The object or array to invert
  5943.      * @return {Object} out A new object with keys
  5944.      * in an array.
  5945.      * @example
  5946.      *
  5947.      *      var raceResultsByFirstName = {
  5948.      *        first: 'alice',
  5949.      *        second: 'jake',
  5950.      *        third: 'alice',
  5951.      *      };
  5952.      *      R.invert(raceResultsByFirstName);
  5953.      *      //=> { 'alice': ['first', 'third'], 'jake':['second'] }
  5954.      */
  5955.     var invert = _curry1(function invert(obj) {
  5956.         var props = keys(obj);
  5957.         var len = props.length;
  5958.         var idx = 0;
  5959.         var out = {};
  5960.         while (idx < len) {
  5961.             var key = props[idx];
  5962.             var val = obj[key];
  5963.             var list = _has(val, out) ? out[val] : out[val] = [];
  5964.             list[list.length] = key;
  5965.             idx += 1;
  5966.         }
  5967.         return out;
  5968.     });
  5969.  
  5970.     /**
  5971.      * Returns a new object with the keys of the given object as values, and the
  5972.      * values of the given object, which are coerced to strings, as keys. Note
  5973.      * that the last key found is preferred when handling the same value.
  5974.      *
  5975.      * @func
  5976.      * @memberOf R
  5977.      * @since v0.9.0
  5978.      * @category Object
  5979.      * @sig {s: x} -> {x: s}
  5980.      * @param {Object} obj The object or array to invert
  5981.      * @return {Object} out A new object
  5982.      * @example
  5983.      *
  5984.      *      var raceResults = {
  5985.      *        first: 'alice',
  5986.      *        second: 'jake'
  5987.      *      };
  5988.      *      R.invertObj(raceResults);
  5989.      *      //=> { 'alice': 'first', 'jake':'second' }
  5990.      *
  5991.      *      // Alternatively:
  5992.      *      var raceResults = ['alice', 'jake'];
  5993.      *      R.invertObj(raceResults);
  5994.      *      //=> { 'alice': '0', 'jake':'1' }
  5995.      */
  5996.     var invertObj = _curry1(function invertObj(obj) {
  5997.         var props = keys(obj);
  5998.         var len = props.length;
  5999.         var idx = 0;
  6000.         var out = {};
  6001.         while (idx < len) {
  6002.             var key = props[idx];
  6003.             out[obj[key]] = key;
  6004.             idx += 1;
  6005.         }
  6006.         return out;
  6007.     });
  6008.  
  6009.     /**
  6010.      * Returns `true` if the given value is its type's empty value; `false`
  6011.      * otherwise.
  6012.      *
  6013.      * @func
  6014.      * @memberOf R
  6015.      * @since v0.1.0
  6016.      * @category Logic
  6017.      * @sig a -> Boolean
  6018.      * @param {*} x
  6019.      * @return {Boolean}
  6020.      * @see R.empty
  6021.      * @example
  6022.      *
  6023.      *      R.isEmpty([1, 2, 3]);   //=> false
  6024.      *      R.isEmpty([]);          //=> true
  6025.      *      R.isEmpty('');          //=> true
  6026.      *      R.isEmpty(null);        //=> false
  6027.      *      R.isEmpty({});          //=> true
  6028.      *      R.isEmpty({length: 0}); //=> false
  6029.      */
  6030.     var isEmpty = _curry1(function isEmpty(x) {
  6031.         return x != null && equals(x, empty(x));
  6032.     });
  6033.  
  6034.     /**
  6035.      * Returns the last element of the given list or string.
  6036.      *
  6037.      * @func
  6038.      * @memberOf R
  6039.      * @since v0.1.4
  6040.      * @category List
  6041.      * @sig [a] -> a | Undefined
  6042.      * @sig String -> String
  6043.      * @param {*} list
  6044.      * @return {*}
  6045.      * @see R.init, R.head, R.tail
  6046.      * @example
  6047.      *
  6048.      *      R.last(['fi', 'fo', 'fum']); //=> 'fum'
  6049.      *      R.last([]); //=> undefined
  6050.      *
  6051.      *      R.last('abc'); //=> 'c'
  6052.      *      R.last(''); //=> ''
  6053.      */
  6054.     var last = nth(-1);
  6055.  
  6056.     /**
  6057.      * Returns the position of the last occurrence of an item in an array, or -1 if
  6058.      * the item is not included in the array. `R.equals` is used to determine
  6059.      * equality.
  6060.      *
  6061.      * @func
  6062.      * @memberOf R
  6063.      * @since v0.1.0
  6064.      * @category List
  6065.      * @sig a -> [a] -> Number
  6066.      * @param {*} target The item to find.
  6067.      * @param {Array} xs The array to search in.
  6068.      * @return {Number} the index of the target, or -1 if the target is not found.
  6069.      * @see R.indexOf
  6070.      * @example
  6071.      *
  6072.      *      R.lastIndexOf(3, [-1,3,3,0,1,2,3,4]); //=> 6
  6073.      *      R.lastIndexOf(10, [1,2,3,4]); //=> -1
  6074.      */
  6075.     var lastIndexOf = _curry2(function lastIndexOf(target, xs) {
  6076.         if (typeof xs.lastIndexOf === 'function' && !_isArray(xs)) {
  6077.             return xs.lastIndexOf(target);
  6078.         } else {
  6079.             var idx = xs.length - 1;
  6080.             while (idx >= 0) {
  6081.                 if (equals(xs[idx], target)) {
  6082.                     return idx;
  6083.                 }
  6084.                 idx -= 1;
  6085.             }
  6086.             return -1;
  6087.         }
  6088.     });
  6089.  
  6090.     /**
  6091.      * Takes a function and
  6092.      * a [functor](https://github.com/fantasyland/fantasy-land#functor),
  6093.      * applies the function to each of the functor's values, and returns
  6094.      * a functor of the same shape.
  6095.      *
  6096.      * Ramda provides suitable `map` implementations for `Array` and `Object`,
  6097.      * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`.
  6098.      *
  6099.      * Dispatches to the `map` method of the second argument, if present.
  6100.      *
  6101.      * Acts as a transducer if a transformer is given in list position.
  6102.      *
  6103.      * Also treats functions as functors and will compose them together.
  6104.      *
  6105.      * @func
  6106.      * @memberOf R
  6107.      * @since v0.1.0
  6108.      * @category List
  6109.      * @sig Functor f => (a -> b) -> f a -> f b
  6110.      * @param {Function} fn The function to be called on every element of the input `list`.
  6111.      * @param {Array} list The list to be iterated over.
  6112.      * @return {Array} The new list.
  6113.      * @see R.transduce, R.addIndex
  6114.      * @example
  6115.      *
  6116.      *      var double = x => x * 2;
  6117.      *
  6118.      *      R.map(double, [1, 2, 3]); //=> [2, 4, 6]
  6119.      *
  6120.      *      R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6}
  6121.      * @symb R.map(f, [a, b]) = [f(a), f(b)]
  6122.      * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) }
  6123.      * @symb R.map(f, functor_o) = functor_o.map(f)
  6124.      */
  6125.     var map = _curry2(_dispatchable(['map'], _xmap, function map(fn, functor) {
  6126.         switch (Object.prototype.toString.call(functor)) {
  6127.         case '[object Function]':
  6128.             return curryN(functor.length, function () {
  6129.                 return fn.call(this, functor.apply(this, arguments));
  6130.             });
  6131.         case '[object Object]':
  6132.             return _reduce(function (acc, key) {
  6133.                 acc[key] = fn(functor[key]);
  6134.                 return acc;
  6135.             }, {}, keys(functor));
  6136.         default:
  6137.             return _map(fn, functor);
  6138.         }
  6139.     }));
  6140.  
  6141.     /**
  6142.      * An Object-specific version of `map`. The function is applied to three
  6143.      * arguments: *(value, key, obj)*. If only the value is significant, use
  6144.      * `map` instead.
  6145.      *
  6146.      * @func
  6147.      * @memberOf R
  6148.      * @since v0.9.0
  6149.      * @category Object
  6150.      * @sig ((*, String, Object) -> *) -> Object -> Object
  6151.      * @param {Function} fn
  6152.      * @param {Object} obj
  6153.      * @return {Object}
  6154.      * @see R.map
  6155.      * @example
  6156.      *
  6157.      *      var values = { x: 1, y: 2, z: 3 };
  6158.      *      var prependKeyAndDouble = (num, key, obj) => key + (num * 2);
  6159.      *
  6160.      *      R.mapObjIndexed(prependKeyAndDouble, values); //=> { x: 'x2', y: 'y4', z: 'z6' }
  6161.      */
  6162.     var mapObjIndexed = _curry2(function mapObjIndexed(fn, obj) {
  6163.         return _reduce(function (acc, key) {
  6164.             acc[key] = fn(obj[key], key, obj);
  6165.             return acc;
  6166.         }, {}, keys(obj));
  6167.     });
  6168.  
  6169.     /**
  6170.      * Creates a new object with the own properties of the two provided objects. If
  6171.      * a key exists in both objects, the provided function is applied to the values
  6172.      * associated with the key in each object, with the result being used as the
  6173.      * value associated with the key in the returned object. The key will be
  6174.      * excluded from the returned object if the resulting value is `undefined`.
  6175.      *
  6176.      * @func
  6177.      * @memberOf R
  6178.      * @since v0.19.0
  6179.      * @category Object
  6180.      * @sig (a -> a -> a) -> {a} -> {a} -> {a}
  6181.      * @param {Function} fn
  6182.      * @param {Object} l
  6183.      * @param {Object} r
  6184.      * @return {Object}
  6185.      * @see R.merge, R.mergeWithKey
  6186.      * @example
  6187.      *
  6188.      *      R.mergeWith(R.concat,
  6189.      *                  { a: true, values: [10, 20] },
  6190.      *                  { b: true, values: [15, 35] });
  6191.      *      //=> { a: true, b: true, values: [10, 20, 15, 35] }
  6192.      */
  6193.     var mergeWith = _curry3(function mergeWith(fn, l, r) {
  6194.         return mergeWithKey(function (_, _l, _r) {
  6195.             return fn(_l, _r);
  6196.         }, l, r);
  6197.     });
  6198.  
  6199.     /**
  6200.      * Takes a function `f` and a list of arguments, and returns a function `g`.
  6201.      * When applied, `g` returns the result of applying `f` to the arguments
  6202.      * provided initially followed by the arguments provided to `g`.
  6203.      *
  6204.      * @func
  6205.      * @memberOf R
  6206.      * @since v0.10.0
  6207.      * @category Function
  6208.      * @sig ((a, b, c, ..., n) -> x) -> [a, b, c, ...] -> ((d, e, f, ..., n) -> x)
  6209.      * @param {Function} f
  6210.      * @param {Array} args
  6211.      * @return {Function}
  6212.      * @see R.partialRight
  6213.      * @example
  6214.      *
  6215.      *      var multiply2 = (a, b) => a * b;
  6216.      *      var double = R.partial(multiply2, [2]);
  6217.      *      double(2); //=> 4
  6218.      *
  6219.      *      var greet = (salutation, title, firstName, lastName) =>
  6220.      *        salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!';
  6221.      *
  6222.      *      var sayHello = R.partial(greet, ['Hello']);
  6223.      *      var sayHelloToMs = R.partial(sayHello, ['Ms.']);
  6224.      *      sayHelloToMs('Jane', 'Jones'); //=> 'Hello, Ms. Jane Jones!'
  6225.      * @symb R.partial(f, [a, b])(c, d) = f(a, b, c, d)
  6226.      */
  6227.     var partial = _createPartialApplicator(_concat);
  6228.  
  6229.     /**
  6230.      * Takes a function `f` and a list of arguments, and returns a function `g`.
  6231.      * When applied, `g` returns the result of applying `f` to the arguments
  6232.      * provided to `g` followed by the arguments provided initially.
  6233.      *
  6234.      * @func
  6235.      * @memberOf R
  6236.      * @since v0.10.0
  6237.      * @category Function
  6238.      * @sig ((a, b, c, ..., n) -> x) -> [d, e, f, ..., n] -> ((a, b, c, ...) -> x)
  6239.      * @param {Function} f
  6240.      * @param {Array} args
  6241.      * @return {Function}
  6242.      * @see R.partial
  6243.      * @example
  6244.      *
  6245.      *      var greet = (salutation, title, firstName, lastName) =>
  6246.      *        salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!';
  6247.      *
  6248.      *      var greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']);
  6249.      *
  6250.      *      greetMsJaneJones('Hello'); //=> 'Hello, Ms. Jane Jones!'
  6251.      * @symb R.partialRight(f, [a, b])(c, d) = f(c, d, a, b)
  6252.      */
  6253.     var partialRight = _createPartialApplicator(flip(_concat));
  6254.  
  6255.     /**
  6256.      * Determines whether a nested path on an object has a specific value, in
  6257.      * `R.equals` terms. Most likely used to filter a list.
  6258.      *
  6259.      * @func
  6260.      * @memberOf R
  6261.      * @since v0.7.0
  6262.      * @category Relation
  6263.      * @typedefn Idx = String | Int
  6264.      * @sig [Idx] -> a -> {a} -> Boolean
  6265.      * @param {Array} path The path of the nested property to use
  6266.      * @param {*} val The value to compare the nested property with
  6267.      * @param {Object} obj The object to check the nested property in
  6268.      * @return {Boolean} `true` if the value equals the nested object property,
  6269.      *         `false` otherwise.
  6270.      * @example
  6271.      *
  6272.      *      var user1 = { address: { zipCode: 90210 } };
  6273.      *      var user2 = { address: { zipCode: 55555 } };
  6274.      *      var user3 = { name: 'Bob' };
  6275.      *      var users = [ user1, user2, user3 ];
  6276.      *      var isFamous = R.pathEq(['address', 'zipCode'], 90210);
  6277.      *      R.filter(isFamous, users); //=> [ user1 ]
  6278.      */
  6279.     var pathEq = _curry3(function pathEq(_path, val, obj) {
  6280.         return equals(path(_path, obj), val);
  6281.     });
  6282.  
  6283.     /**
  6284.      * Returns a new list by plucking the same named property off all objects in
  6285.      * the list supplied.
  6286.      *
  6287.      * @func
  6288.      * @memberOf R
  6289.      * @since v0.1.0
  6290.      * @category List
  6291.      * @sig k -> [{k: v}] -> [v]
  6292.      * @param {Number|String} key The key name to pluck off of each object.
  6293.      * @param {Array} list The array to consider.
  6294.      * @return {Array} The list of values for the given key.
  6295.      * @see R.props
  6296.      * @example
  6297.      *
  6298.      *      R.pluck('a')([{a: 1}, {a: 2}]); //=> [1, 2]
  6299.      *      R.pluck(0)([[1, 2], [3, 4]]);   //=> [1, 3]
  6300.      * @symb R.pluck('x', [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}]) = [1, 3, 5]
  6301.      * @symb R.pluck(0, [[1, 2], [3, 4], [5, 6]]) = [1, 3, 5]
  6302.      */
  6303.     var pluck = _curry2(function pluck(p, list) {
  6304.         return map(prop(p), list);
  6305.     });
  6306.  
  6307.     /**
  6308.      * Reasonable analog to SQL `select` statement.
  6309.      *
  6310.      * @func
  6311.      * @memberOf R
  6312.      * @since v0.1.0
  6313.      * @category Object
  6314.      * @category Relation
  6315.      * @sig [k] -> [{k: v}] -> [{k: v}]
  6316.      * @param {Array} props The property names to project
  6317.      * @param {Array} objs The objects to query
  6318.      * @return {Array} An array of objects with just the `props` properties.
  6319.      * @example
  6320.      *
  6321.      *      var abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2};
  6322.      *      var fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7};
  6323.      *      var kids = [abby, fred];
  6324.      *      R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}]
  6325.      */
  6326.     // passing `identity` gives correct arity
  6327.     var project = useWith(_map, [
  6328.         pickAll,
  6329.         identity
  6330.     ]);
  6331.  
  6332.     /**
  6333.      * Returns `true` if the specified object property is equal, in `R.equals`
  6334.      * terms, to the given value; `false` otherwise.
  6335.      *
  6336.      * @func
  6337.      * @memberOf R
  6338.      * @since v0.1.0
  6339.      * @category Relation
  6340.      * @sig String -> a -> Object -> Boolean
  6341.      * @param {String} name
  6342.      * @param {*} val
  6343.      * @param {*} obj
  6344.      * @return {Boolean}
  6345.      * @see R.equals, R.propSatisfies
  6346.      * @example
  6347.      *
  6348.      *      var abby = {name: 'Abby', age: 7, hair: 'blond'};
  6349.      *      var fred = {name: 'Fred', age: 12, hair: 'brown'};
  6350.      *      var rusty = {name: 'Rusty', age: 10, hair: 'brown'};
  6351.      *      var alois = {name: 'Alois', age: 15, disposition: 'surly'};
  6352.      *      var kids = [abby, fred, rusty, alois];
  6353.      *      var hasBrownHair = R.propEq('hair', 'brown');
  6354.      *      R.filter(hasBrownHair, kids); //=> [fred, rusty]
  6355.      */
  6356.     var propEq = _curry3(function propEq(name, val, obj) {
  6357.         return equals(val, obj[name]);
  6358.     });
  6359.  
  6360.     /**
  6361.      * Returns a single item by iterating through the list, successively calling
  6362.      * the iterator function and passing it an accumulator value and the current
  6363.      * value from the array, and then passing the result to the next call.
  6364.      *
  6365.      * The iterator function receives two values: *(acc, value)*. It may use
  6366.      * `R.reduced` to shortcut the iteration.
  6367.      *
  6368.      * The arguments' order of `reduceRight`'s iterator function is *(value, acc)*.
  6369.      *
  6370.      * Note: `R.reduce` does not skip deleted or unassigned indices (sparse
  6371.      * arrays), unlike the native `Array.prototype.reduce` method. For more details
  6372.      * on this behavior, see:
  6373.      * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#Description
  6374.      *
  6375.      * Dispatches to the `reduce` method of the third argument, if present.
  6376.      *
  6377.      * @func
  6378.      * @memberOf R
  6379.      * @since v0.1.0
  6380.      * @category List
  6381.      * @sig ((a, b) -> a) -> a -> [b] -> a
  6382.      * @param {Function} fn The iterator function. Receives two values, the accumulator and the
  6383.      *        current element from the array.
  6384.      * @param {*} acc The accumulator value.
  6385.      * @param {Array} list The list to iterate over.
  6386.      * @return {*} The final, accumulated value.
  6387.      * @see R.reduced, R.addIndex, R.reduceRight
  6388.      * @example
  6389.      *
  6390.      *      R.reduce(R.subtract, 0, [1, 2, 3, 4]) // => ((((0 - 1) - 2) - 3) - 4) = -10
  6391.      *                -               -10
  6392.      *               / \              / \
  6393.      *              -   4           -6   4
  6394.      *             / \              / \
  6395.      *            -   3   ==>     -3   3
  6396.      *           / \              / \
  6397.      *          -   2           -1   2
  6398.      *         / \              / \
  6399.      *        0   1            0   1
  6400.      *
  6401.      * @symb R.reduce(f, a, [b, c, d]) = f(f(f(a, b), c), d)
  6402.      */
  6403.     var reduce = _curry3(_reduce);
  6404.  
  6405.     /**
  6406.      * Groups the elements of the list according to the result of calling
  6407.      * the String-returning function `keyFn` on each element and reduces the elements
  6408.      * of each group to a single value via the reducer function `valueFn`.
  6409.      *
  6410.      * This function is basically a more general `groupBy` function.
  6411.      *
  6412.      * Acts as a transducer if a transformer is given in list position.
  6413.      *
  6414.      * @func
  6415.      * @memberOf R
  6416.      * @since v0.20.0
  6417.      * @category List
  6418.      * @sig ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a}
  6419.      * @param {Function} valueFn The function that reduces the elements of each group to a single
  6420.      *        value. Receives two values, accumulator for a particular group and the current element.
  6421.      * @param {*} acc The (initial) accumulator value for each group.
  6422.      * @param {Function} keyFn The function that maps the list's element into a key.
  6423.      * @param {Array} list The array to group.
  6424.      * @return {Object} An object with the output of `keyFn` for keys, mapped to the output of
  6425.      *         `valueFn` for elements which produced that key when passed to `keyFn`.
  6426.      * @see R.groupBy, R.reduce
  6427.      * @example
  6428.      *
  6429.      *      var reduceToNamesBy = R.reduceBy((acc, student) => acc.concat(student.name), []);
  6430.      *      var namesByGrade = reduceToNamesBy(function(student) {
  6431.      *        var score = student.score;
  6432.      *        return score < 65 ? 'F' :
  6433.      *               score < 70 ? 'D' :
  6434.      *               score < 80 ? 'C' :
  6435.      *               score < 90 ? 'B' : 'A';
  6436.      *      });
  6437.      *      var students = [{name: 'Lucy', score: 92},
  6438.      *                      {name: 'Drew', score: 85},
  6439.      *                      // ...
  6440.      *                      {name: 'Bart', score: 62}];
  6441.      *      namesByGrade(students);
  6442.      *      // {
  6443.      *      //   'A': ['Lucy'],
  6444.      *      //   'B': ['Drew']
  6445.      *      //   // ...,
  6446.      *      //   'F': ['Bart']
  6447.      *      // }
  6448.      */
  6449.     var reduceBy = _curryN(4, [], _dispatchable([], _xreduceBy, function reduceBy(valueFn, valueAcc, keyFn, list) {
  6450.         return _reduce(function (acc, elt) {
  6451.             var key = keyFn(elt);
  6452.             acc[key] = valueFn(_has(key, acc) ? acc[key] : valueAcc, elt);
  6453.             return acc;
  6454.         }, {}, list);
  6455.     }));
  6456.  
  6457.     /**
  6458.      * Like `reduce`, `reduceWhile` returns a single item by iterating through
  6459.      * the list, successively calling the iterator function. `reduceWhile` also
  6460.      * takes a predicate that is evaluated before each step. If the predicate returns
  6461.      * `false`, it "short-circuits" the iteration and returns the current value
  6462.      * of the accumulator.
  6463.      *
  6464.      * @func
  6465.      * @memberOf R
  6466.      * @since v0.22.0
  6467.      * @category List
  6468.      * @sig ((a, b) -> Boolean) -> ((a, b) -> a) -> a -> [b] -> a
  6469.      * @param {Function} pred The predicate. It is passed the accumulator and the
  6470.      *        current element.
  6471.      * @param {Function} fn The iterator function. Receives two values, the
  6472.      *        accumulator and the current element.
  6473.      * @param {*} a The accumulator value.
  6474.      * @param {Array} list The list to iterate over.
  6475.      * @return {*} The final, accumulated value.
  6476.      * @see R.reduce, R.reduced
  6477.      * @example
  6478.      *
  6479.      *      var isOdd = (acc, x) => x % 2 === 1;
  6480.      *      var xs = [1, 3, 5, 60, 777, 800];
  6481.      *      R.reduceWhile(isOdd, R.add, 0, xs); //=> 9
  6482.      *
  6483.      *      var ys = [2, 4, 6]
  6484.      *      R.reduceWhile(isOdd, R.add, 111, ys); //=> 111
  6485.      */
  6486.     var reduceWhile = _curryN(4, [], function _reduceWhile(pred, fn, a, list) {
  6487.         return _reduce(function (acc, x) {
  6488.             return pred(acc, x) ? fn(acc, x) : _reduced(acc);
  6489.         }, a, list);
  6490.     });
  6491.  
  6492.     /**
  6493.      * The complement of `filter`.
  6494.      *
  6495.      * Acts as a transducer if a transformer is given in list position.
  6496.      *
  6497.      * @func
  6498.      * @memberOf R
  6499.      * @since v0.1.0
  6500.      * @category List
  6501.      * @sig Filterable f => (a -> Boolean) -> f a -> f a
  6502.      * @param {Function} pred
  6503.      * @param {Array} filterable
  6504.      * @return {Array}
  6505.      * @see R.filter, R.transduce, R.addIndex
  6506.      * @example
  6507.      *
  6508.      *      var isOdd = (n) => n % 2 === 1;
  6509.      *
  6510.      *      R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4]
  6511.      *
  6512.      *      R.reject(isOdd, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}
  6513.      */
  6514.     var reject = _curry2(function reject(pred, filterable) {
  6515.         return filter(_complement(pred), filterable);
  6516.     });
  6517.  
  6518.     /**
  6519.      * Returns a fixed list of size `n` containing a specified identical value.
  6520.      *
  6521.      * @func
  6522.      * @memberOf R
  6523.      * @since v0.1.1
  6524.      * @category List
  6525.      * @sig a -> n -> [a]
  6526.      * @param {*} value The value to repeat.
  6527.      * @param {Number} n The desired size of the output list.
  6528.      * @return {Array} A new array containing `n` `value`s.
  6529.      * @example
  6530.      *
  6531.      *      R.repeat('hi', 5); //=> ['hi', 'hi', 'hi', 'hi', 'hi']
  6532.      *
  6533.      *      var obj = {};
  6534.      *      var repeatedObjs = R.repeat(obj, 5); //=> [{}, {}, {}, {}, {}]
  6535.      *      repeatedObjs[0] === repeatedObjs[1]; //=> true
  6536.      * @symb R.repeat(a, 0) = []
  6537.      * @symb R.repeat(a, 1) = [a]
  6538.      * @symb R.repeat(a, 2) = [a, a]
  6539.      */
  6540.     var repeat = _curry2(function repeat(value, n) {
  6541.         return times(always(value), n);
  6542.     });
  6543.  
  6544.     /**
  6545.      * Adds together all the elements of a list.
  6546.      *
  6547.      * @func
  6548.      * @memberOf R
  6549.      * @since v0.1.0
  6550.      * @category Math
  6551.      * @sig [Number] -> Number
  6552.      * @param {Array} list An array of numbers
  6553.      * @return {Number} The sum of all the numbers in the list.
  6554.      * @see R.reduce
  6555.      * @example
  6556.      *
  6557.      *      R.sum([2,4,6,8,100,1]); //=> 121
  6558.      */
  6559.     var sum = reduce(add, 0);
  6560.  
  6561.     /**
  6562.      * Returns a new list containing the last `n` elements of the given list.
  6563.      * If `n > list.length`, returns a list of `list.length` elements.
  6564.      *
  6565.      * @func
  6566.      * @memberOf R
  6567.      * @since v0.16.0
  6568.      * @category List
  6569.      * @sig Number -> [a] -> [a]
  6570.      * @sig Number -> String -> String
  6571.      * @param {Number} n The number of elements to return.
  6572.      * @param {Array} xs The collection to consider.
  6573.      * @return {Array}
  6574.      * @see R.dropLast
  6575.      * @example
  6576.      *
  6577.      *      R.takeLast(1, ['foo', 'bar', 'baz']); //=> ['baz']
  6578.      *      R.takeLast(2, ['foo', 'bar', 'baz']); //=> ['bar', 'baz']
  6579.      *      R.takeLast(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
  6580.      *      R.takeLast(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
  6581.      *      R.takeLast(3, 'ramda');               //=> 'mda'
  6582.      */
  6583.     var takeLast = _curry2(function takeLast(n, xs) {
  6584.         return drop(n >= 0 ? xs.length - n : 0, xs);
  6585.     });
  6586.  
  6587.     /**
  6588.      * Initializes a transducer using supplied iterator function. Returns a single
  6589.      * item by iterating through the list, successively calling the transformed
  6590.      * iterator function and passing it an accumulator value and the current value
  6591.      * from the array, and then passing the result to the next call.
  6592.      *
  6593.      * The iterator function receives two values: *(acc, value)*. It will be
  6594.      * wrapped as a transformer to initialize the transducer. A transformer can be
  6595.      * passed directly in place of an iterator function. In both cases, iteration
  6596.      * may be stopped early with the `R.reduced` function.
  6597.      *
  6598.      * A transducer is a function that accepts a transformer and returns a
  6599.      * transformer and can be composed directly.
  6600.      *
  6601.      * A transformer is an an object that provides a 2-arity reducing iterator
  6602.      * function, step, 0-arity initial value function, init, and 1-arity result
  6603.      * extraction function, result. The step function is used as the iterator
  6604.      * function in reduce. The result function is used to convert the final
  6605.      * accumulator into the return type and in most cases is R.identity. The init
  6606.      * function can be used to provide an initial accumulator, but is ignored by
  6607.      * transduce.
  6608.      *
  6609.      * The iteration is performed with R.reduce after initializing the transducer.
  6610.      *
  6611.      * @func
  6612.      * @memberOf R
  6613.      * @since v0.12.0
  6614.      * @category List
  6615.      * @sig (c -> c) -> (a,b -> a) -> a -> [b] -> a
  6616.      * @param {Function} xf The transducer function. Receives a transformer and returns a transformer.
  6617.      * @param {Function} fn The iterator function. Receives two values, the accumulator and the
  6618.      *        current element from the array. Wrapped as transformer, if necessary, and used to
  6619.      *        initialize the transducer
  6620.      * @param {*} acc The initial accumulator value.
  6621.      * @param {Array} list The list to iterate over.
  6622.      * @return {*} The final, accumulated value.
  6623.      * @see R.reduce, R.reduced, R.into
  6624.      * @example
  6625.      *
  6626.      *      var numbers = [1, 2, 3, 4];
  6627.      *      var transducer = R.compose(R.map(R.add(1)), R.take(2));
  6628.      *
  6629.      *      R.transduce(transducer, R.flip(R.append), [], numbers); //=> [2, 3]
  6630.      */
  6631.     var transduce = curryN(4, function transduce(xf, fn, acc, list) {
  6632.         return _reduce(xf(typeof fn === 'function' ? _xwrap(fn) : fn), acc, list);
  6633.     });
  6634.  
  6635.     /**
  6636.      * Combines two lists into a set (i.e. no duplicates) composed of the elements
  6637.      * of each list. Duplication is determined according to the value returned by
  6638.      * applying the supplied predicate to two list elements.
  6639.      *
  6640.      * @func
  6641.      * @memberOf R
  6642.      * @since v0.1.0
  6643.      * @category Relation
  6644.      * @sig (a -> a -> Boolean) -> [*] -> [*] -> [*]
  6645.      * @param {Function} pred A predicate used to test whether two items are equal.
  6646.      * @param {Array} list1 The first list.
  6647.      * @param {Array} list2 The second list.
  6648.      * @return {Array} The first and second lists concatenated, with
  6649.      *         duplicates removed.
  6650.      * @see R.union
  6651.      * @example
  6652.      *
  6653.      *      var l1 = [{a: 1}, {a: 2}];
  6654.      *      var l2 = [{a: 1}, {a: 4}];
  6655.      *      R.unionWith(R.eqBy(R.prop('a')), l1, l2); //=> [{a: 1}, {a: 2}, {a: 4}]
  6656.      */
  6657.     var unionWith = _curry3(function unionWith(pred, list1, list2) {
  6658.         return uniqWith(pred, _concat(list1, list2));
  6659.     });
  6660.  
  6661.     /**
  6662.      * Takes a spec object and a test object; returns true if the test satisfies
  6663.      * the spec, false otherwise. An object satisfies the spec if, for each of the
  6664.      * spec's own properties, accessing that property of the object gives the same
  6665.      * value (in `R.equals` terms) as accessing that property of the spec.
  6666.      *
  6667.      * `whereEq` is a specialization of [`where`](#where).
  6668.      *
  6669.      * @func
  6670.      * @memberOf R
  6671.      * @since v0.14.0
  6672.      * @category Object
  6673.      * @sig {String: *} -> {String: *} -> Boolean
  6674.      * @param {Object} spec
  6675.      * @param {Object} testObj
  6676.      * @return {Boolean}
  6677.      * @see R.where
  6678.      * @example
  6679.      *
  6680.      *      // pred :: Object -> Boolean
  6681.      *      var pred = R.whereEq({a: 1, b: 2});
  6682.      *
  6683.      *      pred({a: 1});              //=> false
  6684.      *      pred({a: 1, b: 2});        //=> true
  6685.      *      pred({a: 1, b: 2, c: 3});  //=> true
  6686.      *      pred({a: 1, b: 1});        //=> false
  6687.      */
  6688.     var whereEq = _curry2(function whereEq(spec, testObj) {
  6689.         return where(map(equals, spec), testObj);
  6690.     });
  6691.  
  6692.     var _flatCat = function () {
  6693.         var preservingReduced = function (xf) {
  6694.             return {
  6695.                 '@@transducer/init': _xfBase.init,
  6696.                 '@@transducer/result': function (result) {
  6697.                     return xf['@@transducer/result'](result);
  6698.                 },
  6699.                 '@@transducer/step': function (result, input) {
  6700.                     var ret = xf['@@transducer/step'](result, input);
  6701.                     return ret['@@transducer/reduced'] ? _forceReduced(ret) : ret;
  6702.                 }
  6703.             };
  6704.         };
  6705.         return function _xcat(xf) {
  6706.             var rxf = preservingReduced(xf);
  6707.             return {
  6708.                 '@@transducer/init': _xfBase.init,
  6709.                 '@@transducer/result': function (result) {
  6710.                     return rxf['@@transducer/result'](result);
  6711.                 },
  6712.                 '@@transducer/step': function (result, input) {
  6713.                     return !isArrayLike(input) ? _reduce(rxf, result, [input]) : _reduce(rxf, result, input);
  6714.                 }
  6715.             };
  6716.         };
  6717.     }();
  6718.  
  6719.     // Array.prototype.indexOf doesn't exist below IE9
  6720.     // manually crawl the list to distinguish between +0 and -0
  6721.     // NaN
  6722.     // non-zero numbers can utilise Set
  6723.     // all these types can utilise Set
  6724.     // null can utilise Set
  6725.     // anything else not covered above, defer to R.equals
  6726.     var _indexOf = function _indexOf(list, a, idx) {
  6727.         var inf, item;
  6728.         // Array.prototype.indexOf doesn't exist below IE9
  6729.         if (typeof list.indexOf === 'function') {
  6730.             switch (typeof a) {
  6731.             case 'number':
  6732.                 if (a === 0) {
  6733.                     // manually crawl the list to distinguish between +0 and -0
  6734.                     inf = 1 / a;
  6735.                     while (idx < list.length) {
  6736.                         item = list[idx];
  6737.                         if (item === 0 && 1 / item === inf) {
  6738.                             return idx;
  6739.                         }
  6740.                         idx += 1;
  6741.                     }
  6742.                     return -1;
  6743.                 } else if (a !== a) {
  6744.                     // NaN
  6745.                     while (idx < list.length) {
  6746.                         item = list[idx];
  6747.                         if (typeof item === 'number' && item !== item) {
  6748.                             return idx;
  6749.                         }
  6750.                         idx += 1;
  6751.                     }
  6752.                     return -1;
  6753.                 }
  6754.                 // non-zero numbers can utilise Set
  6755.                 return list.indexOf(a, idx);
  6756.             // all these types can utilise Set
  6757.             case 'string':
  6758.             case 'boolean':
  6759.             case 'function':
  6760.             case 'undefined':
  6761.                 return list.indexOf(a, idx);
  6762.             case 'object':
  6763.                 if (a === null) {
  6764.                     // null can utilise Set
  6765.                     return list.indexOf(a, idx);
  6766.                 }
  6767.             }
  6768.         }
  6769.         // anything else not covered above, defer to R.equals
  6770.         while (idx < list.length) {
  6771.             if (equals(list[idx], a)) {
  6772.                 return idx;
  6773.             }
  6774.             idx += 1;
  6775.         }
  6776.         return -1;
  6777.     };
  6778.  
  6779.     var _xchain = _curry2(function _xchain(f, xf) {
  6780.         return map(f, _flatCat(xf));
  6781.     });
  6782.  
  6783.     /**
  6784.      * Takes a list of predicates and returns a predicate that returns true for a
  6785.      * given list of arguments if every one of the provided predicates is satisfied
  6786.      * by those arguments.
  6787.      *
  6788.      * The function returned is a curried function whose arity matches that of the
  6789.      * highest-arity predicate.
  6790.      *
  6791.      * @func
  6792.      * @memberOf R
  6793.      * @since v0.9.0
  6794.      * @category Logic
  6795.      * @sig [(*... -> Boolean)] -> (*... -> Boolean)
  6796.      * @param {Array} predicates An array of predicates to check
  6797.      * @return {Function} The combined predicate
  6798.      * @see R.anyPass
  6799.      * @example
  6800.      *
  6801.      *      var isQueen = R.propEq('rank', 'Q');
  6802.      *      var isSpade = R.propEq('suit', '??');
  6803.      *      var isQueenOfSpades = R.allPass([isQueen, isSpade]);
  6804.      *
  6805.      *      isQueenOfSpades({rank: 'Q', suit: '??'}); //=> false
  6806.      *      isQueenOfSpades({rank: 'Q', suit: '??'}); //=> true
  6807.      */
  6808.     var allPass = _curry1(function allPass(preds) {
  6809.         return curryN(reduce(max, 0, pluck('length', preds)), function () {
  6810.             var idx = 0;
  6811.             var len = preds.length;
  6812.             while (idx < len) {
  6813.                 if (!preds[idx].apply(this, arguments)) {
  6814.                     return false;
  6815.                 }
  6816.                 idx += 1;
  6817.             }
  6818.             return true;
  6819.         });
  6820.     });
  6821.  
  6822.     /**
  6823.      * Takes a list of predicates and returns a predicate that returns true for a
  6824.      * given list of arguments if at least one of the provided predicates is
  6825.      * satisfied by those arguments.
  6826.      *
  6827.      * The function returned is a curried function whose arity matches that of the
  6828.      * highest-arity predicate.
  6829.      *
  6830.      * @func
  6831.      * @memberOf R
  6832.      * @since v0.9.0
  6833.      * @category Logic
  6834.      * @sig [(*... -> Boolean)] -> (*... -> Boolean)
  6835.      * @param {Array} predicates An array of predicates to check
  6836.      * @return {Function} The combined predicate
  6837.      * @see R.allPass
  6838.      * @example
  6839.      *
  6840.      *      var isClub = R.propEq('suit', '?');
  6841.      *      var isSpade = R.propEq('suit', '?');
  6842.      *      var isBlackCard = R.anyPass([isClub, isSpade]);
  6843.      *
  6844.      *      isBlackCard({rank: '10', suit: '?'}); //=> true
  6845.      *      isBlackCard({rank: 'Q', suit: '?'}); //=> true
  6846.      *      isBlackCard({rank: 'Q', suit: '?'}); //=> false
  6847.      */
  6848.     var anyPass = _curry1(function anyPass(preds) {
  6849.         return curryN(reduce(max, 0, pluck('length', preds)), function () {
  6850.             var idx = 0;
  6851.             var len = preds.length;
  6852.             while (idx < len) {
  6853.                 if (preds[idx].apply(this, arguments)) {
  6854.                     return true;
  6855.                 }
  6856.                 idx += 1;
  6857.             }
  6858.             return false;
  6859.         });
  6860.     });
  6861.  
  6862.     /**
  6863.      * ap applies a list of functions to a list of values.
  6864.      *
  6865.      * Dispatches to the `ap` method of the second argument, if present. Also
  6866.      * treats curried functions as applicatives.
  6867.      *
  6868.      * @func
  6869.      * @memberOf R
  6870.      * @since v0.3.0
  6871.      * @category Function
  6872.      * @sig [a -> b] -> [a] -> [b]
  6873.      * @sig Apply f => f (a -> b) -> f a -> f b
  6874.      * @param {Array} fns An array of functions
  6875.      * @param {Array} vs An array of values
  6876.      * @return {Array} An array of results of applying each of `fns` to all of `vs` in turn.
  6877.      * @example
  6878.      *
  6879.      *      R.ap([R.multiply(2), R.add(3)], [1,2,3]); //=> [2, 4, 6, 4, 5, 6]
  6880.      *      R.ap([R.concat('tasty '), R.toUpper], ['pizza', 'salad']); //=> ["tasty pizza", "tasty salad", "PIZZA", "SALAD"]
  6881.      * @symb R.ap([f, g], [a, b]) = [f(a), f(b), g(a), g(b)]
  6882.      */
  6883.     // else
  6884.     var ap = _curry2(function ap(applicative, fn) {
  6885.         return typeof applicative.ap === 'function' ? applicative.ap(fn) : typeof applicative === 'function' ? function (x) {
  6886.             return applicative(x)(fn(x));
  6887.         } : // else
  6888.         _reduce(function (acc, f) {
  6889.             return _concat(acc, map(f, fn));
  6890.         }, [], applicative);
  6891.     });
  6892.  
  6893.     /**
  6894.      * Given a spec object recursively mapping properties to functions, creates a
  6895.      * function producing an object of the same structure, by mapping each property
  6896.      * to the result of calling its associated function with the supplied arguments.
  6897.      *
  6898.      * @func
  6899.      * @memberOf R
  6900.      * @since v0.20.0
  6901.      * @category Function
  6902.      * @sig {k: ((a, b, ..., m) -> v)} -> ((a, b, ..., m) -> {k: v})
  6903.      * @param {Object} spec an object recursively mapping properties to functions for
  6904.      *        producing the values for these properties.
  6905.      * @return {Function} A function that returns an object of the same structure
  6906.      * as `spec', with each property set to the value returned by calling its
  6907.      * associated function with the supplied arguments.
  6908.      * @see R.converge, R.juxt
  6909.      * @example
  6910.      *
  6911.      *      var getMetrics = R.applySpec({
  6912.      *                                      sum: R.add,
  6913.      *                                      nested: { mul: R.multiply }
  6914.      *                                   });
  6915.      *      getMetrics(2, 4); // => { sum: 6, nested: { mul: 8 } }
  6916.      * @symb R.applySpec({ x: f, y: { z: g } })(a, b) = { x: f(a, b), y: { z: g(a, b) } }
  6917.      */
  6918.     var applySpec = _curry1(function applySpec(spec) {
  6919.         spec = map(function (v) {
  6920.             return typeof v == 'function' ? v : applySpec(v);
  6921.         }, spec);
  6922.         return curryN(reduce(max, 0, pluck('length', values(spec))), function () {
  6923.             var args = arguments;
  6924.             return map(function (f) {
  6925.                 return apply(f, args);
  6926.             }, spec);
  6927.         });
  6928.     });
  6929.  
  6930.     /**
  6931.      * Returns the result of calling its first argument with the remaining
  6932.      * arguments. This is occasionally useful as a converging function for
  6933.      * `R.converge`: the left branch can produce a function while the right branch
  6934.      * produces a value to be passed to that function as an argument.
  6935.      *
  6936.      * @func
  6937.      * @memberOf R
  6938.      * @since v0.9.0
  6939.      * @category Function
  6940.      * @sig (*... -> a),*... -> a
  6941.      * @param {Function} fn The function to apply to the remaining arguments.
  6942.      * @param {...*} args Any number of positional arguments.
  6943.      * @return {*}
  6944.      * @see R.apply
  6945.      * @example
  6946.      *
  6947.      *      R.call(R.add, 1, 2); //=> 3
  6948.      *
  6949.      *      var indentN = R.pipe(R.times(R.always(' ')),
  6950.      *                           R.join(''),
  6951.      *                           R.replace(/^(?!$)/gm));
  6952.      *
  6953.      *      var format = R.converge(R.call, [
  6954.      *                                  R.pipe(R.prop('indent'), indentN),
  6955.      *                                  R.prop('value')
  6956.      *                              ]);
  6957.      *
  6958.      *      format({indent: 2, value: 'foo\nbar\nbaz\n'}); //=> '  foo\n  bar\n  baz\n'
  6959.      * @symb R.call(f, a, b) = f(a, b)
  6960.      */
  6961.     var call = curry(function call(fn) {
  6962.         return fn.apply(this, Array.prototype.slice.call(arguments, 1));
  6963.     });
  6964.  
  6965.     /**
  6966.      * `chain` maps a function over a list and concatenates the results. `chain`
  6967.      * is also known as `flatMap` in some libraries
  6968.      *
  6969.      * Dispatches to the `chain` method of the second argument, if present,
  6970.      * according to the [FantasyLand Chain spec](https://github.com/fantasyland/fantasy-land#chain).
  6971.      *
  6972.      * @func
  6973.      * @memberOf R
  6974.      * @since v0.3.0
  6975.      * @category List
  6976.      * @sig Chain m => (a -> m b) -> m a -> m b
  6977.      * @param {Function} fn The function to map with
  6978.      * @param {Array} list The list to map over
  6979.      * @return {Array} The result of flat-mapping `list` with `fn`
  6980.      * @example
  6981.      *
  6982.      *      var duplicate = n => [n, n];
  6983.      *      R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3]
  6984.      *
  6985.      *      R.chain(R.append, R.head)([1, 2, 3]); //=> [1, 2, 3, 1]
  6986.      */
  6987.     var chain = _curry2(_dispatchable(['chain'], _xchain, function chain(fn, monad) {
  6988.         if (typeof monad === 'function') {
  6989.             return function (x) {
  6990.                 return fn(monad(x))(x);
  6991.             };
  6992.         }
  6993.         return _makeFlat(false)(map(fn, monad));
  6994.     }));
  6995.  
  6996.     /**
  6997.      * Returns a function, `fn`, which encapsulates `if/else, if/else, ...` logic.
  6998.      * `R.cond` takes a list of [predicate, transformer] pairs. All of the arguments
  6999.      * to `fn` are applied to each of the predicates in turn until one returns a
  7000.      * "truthy" value, at which point `fn` returns the result of applying its
  7001.      * arguments to the corresponding transformer. If none of the predicates
  7002.      * matches, `fn` returns undefined.
  7003.      *
  7004.      * @func
  7005.      * @memberOf R
  7006.      * @since v0.6.0
  7007.      * @category Logic
  7008.      * @sig [[(*... -> Boolean),(*... -> *)]] -> (*... -> *)
  7009.      * @param {Array} pairs A list of [predicate, transformer]
  7010.      * @return {Function}
  7011.      * @example
  7012.      *
  7013.      *      var fn = R.cond([
  7014.      *        [R.equals(0),   R.always('water freezes at 0�C')],
  7015.      *        [R.equals(100), R.always('water boils at 100�C')],
  7016.      *        [R.T,           temp => 'nothing special happens at ' + temp + '�C']
  7017.      *      ]);
  7018.      *      fn(0); //=> 'water freezes at 0�C'
  7019.      *      fn(50); //=> 'nothing special happens at 50�C'
  7020.      *      fn(100); //=> 'water boils at 100�C'
  7021.      */
  7022.     var cond = _curry1(function cond(pairs) {
  7023.         var arity = reduce(max, 0, map(function (pair) {
  7024.             return pair[0].length;
  7025.         }, pairs));
  7026.         return _arity(arity, function () {
  7027.             var idx = 0;
  7028.             while (idx < pairs.length) {
  7029.                 if (pairs[idx][0].apply(this, arguments)) {
  7030.                     return pairs[idx][1].apply(this, arguments);
  7031.                 }
  7032.                 idx += 1;
  7033.             }
  7034.         });
  7035.     });
  7036.  
  7037.     /**
  7038.      * Wraps a constructor function inside a curried function that can be called
  7039.      * with the same arguments and returns the same type. The arity of the function
  7040.      * returned is specified to allow using variadic constructor functions.
  7041.      *
  7042.      * @func
  7043.      * @memberOf R
  7044.      * @since v0.4.0
  7045.      * @category Function
  7046.      * @sig Number -> (* -> {*}) -> (* -> {*})
  7047.      * @param {Number} n The arity of the constructor function.
  7048.      * @param {Function} Fn The constructor function to wrap.
  7049.      * @return {Function} A wrapped, curried constructor function.
  7050.      * @example
  7051.      *
  7052.      *      // Variadic Constructor function
  7053.      *      function Salad() {
  7054.      *        this.ingredients = arguments;
  7055.      *      };
  7056.      *      Salad.prototype.recipe = function() {
  7057.      *        var instructions = R.map((ingredient) => (
  7058.      *          'Add a whollop of ' + ingredient, this.ingredients)
  7059.      *        )
  7060.      *        return R.join('\n', instructions)
  7061.      *      }
  7062.      *
  7063.      *      var ThreeLayerSalad = R.constructN(3, Salad)
  7064.      *
  7065.      *      // Notice we no longer need the 'new' keyword, and the constructor is curried for 3 arguments.
  7066.      *      var salad = ThreeLayerSalad('Mayonnaise')('Potato Chips')('Ketchup')
  7067.      *      console.log(salad.recipe());
  7068.      *      // Add a whollop of Mayonnaise
  7069.      *      // Add a whollop of Potato Chips
  7070.      *      // Add a whollop of Potato Ketchup
  7071.      */
  7072.     var constructN = _curry2(function constructN(n, Fn) {
  7073.         if (n > 10) {
  7074.             throw new Error('Constructor with greater than ten arguments');
  7075.         }
  7076.         if (n === 0) {
  7077.             return function () {
  7078.                 return new Fn();
  7079.             };
  7080.         }
  7081.         return curry(nAry(n, function ($0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
  7082.             switch (arguments.length) {
  7083.             case 1:
  7084.                 return new Fn($0);
  7085.             case 2:
  7086.                 return new Fn($0, $1);
  7087.             case 3:
  7088.                 return new Fn($0, $1, $2);
  7089.             case 4:
  7090.                 return new Fn($0, $1, $2, $3);
  7091.             case 5:
  7092.                 return new Fn($0, $1, $2, $3, $4);
  7093.             case 6:
  7094.                 return new Fn($0, $1, $2, $3, $4, $5);
  7095.             case 7:
  7096.                 return new Fn($0, $1, $2, $3, $4, $5, $6);
  7097.             case 8:
  7098.                 return new Fn($0, $1, $2, $3, $4, $5, $6, $7);
  7099.             case 9:
  7100.                 return new Fn($0, $1, $2, $3, $4, $5, $6, $7, $8);
  7101.             case 10:
  7102.                 return new Fn($0, $1, $2, $3, $4, $5, $6, $7, $8, $9);
  7103.             }
  7104.         }));
  7105.     });
  7106.  
  7107.     /**
  7108.      * Accepts a converging function and a list of branching functions and returns
  7109.      * a new function. When invoked, this new function is applied to some
  7110.      * arguments, each branching function is applied to those same arguments. The
  7111.      * results of each branching function are passed as arguments to the converging
  7112.      * function to produce the return value.
  7113.      *
  7114.      * @func
  7115.      * @memberOf R
  7116.      * @since v0.4.2
  7117.      * @category Function
  7118.      * @sig (x1 -> x2 -> ... -> z) -> [(a -> b -> ... -> x1), (a -> b -> ... -> x2), ...] -> (a -> b -> ... -> z)
  7119.      * @param {Function} after A function. `after` will be invoked with the return values of
  7120.      *        `fn1` and `fn2` as its arguments.
  7121.      * @param {Array} functions A list of functions.
  7122.      * @return {Function} A new function.
  7123.      * @see R.useWith
  7124.      * @example
  7125.      *
  7126.      *      var average = R.converge(R.divide, [R.sum, R.length])
  7127.      *      average([1, 2, 3, 4, 5, 6, 7]) //=> 4
  7128.      *
  7129.      *      var strangeConcat = R.converge(R.concat, [R.toUpper, R.toLower])
  7130.      *      strangeConcat("Yodel") //=> "YODELyodel"
  7131.      *
  7132.      * @symb R.converge(f, [g, h])(a, b) = f(g(a, b), h(a, b))
  7133.      */
  7134.     var converge = _curry2(function converge(after, fns) {
  7135.         return curryN(reduce(max, 0, pluck('length', fns)), function () {
  7136.             var args = arguments;
  7137.             var context = this;
  7138.             return after.apply(context, _map(function (fn) {
  7139.                 return fn.apply(context, args);
  7140.             }, fns));
  7141.         });
  7142.     });
  7143.  
  7144.     /**
  7145.      * Counts the elements of a list according to how many match each value of a
  7146.      * key generated by the supplied function. Returns an object mapping the keys
  7147.      * produced by `fn` to the number of occurrences in the list. Note that all
  7148.      * keys are coerced to strings because of how JavaScript objects work.
  7149.      *
  7150.      * Acts as a transducer if a transformer is given in list position.
  7151.      *
  7152.      * @func
  7153.      * @memberOf R
  7154.      * @since v0.1.0
  7155.      * @category Relation
  7156.      * @sig (a -> String) -> [a] -> {*}
  7157.      * @param {Function} fn The function used to map values to keys.
  7158.      * @param {Array} list The list to count elements from.
  7159.      * @return {Object} An object mapping keys to number of occurrences in the list.
  7160.      * @example
  7161.      *
  7162.      *      var numbers = [1.0, 1.1, 1.2, 2.0, 3.0, 2.2];
  7163.      *      R.countBy(Math.floor)(numbers);    //=> {'1': 3, '2': 2, '3': 1}
  7164.      *
  7165.      *      var letters = ['a', 'b', 'A', 'a', 'B', 'c'];
  7166.      *      R.countBy(R.toLower)(letters);   //=> {'a': 3, 'b': 2, 'c': 1}
  7167.      */
  7168.     var countBy = reduceBy(function (acc, elem) {
  7169.         return acc + 1;
  7170.     }, 0);
  7171.  
  7172.     /**
  7173.      * Returns a new list without any consecutively repeating elements. Equality is
  7174.      * determined by applying the supplied predicate to each pair of consecutive elements. The
  7175.      * first element in a series of equal elements will be preserved.
  7176.      *
  7177.      * Acts as a transducer if a transformer is given in list position.
  7178.      *
  7179.      * @func
  7180.      * @memberOf R
  7181.      * @since v0.14.0
  7182.      * @category List
  7183.      * @sig (a, a -> Boolean) -> [a] -> [a]
  7184.      * @param {Function} pred A predicate used to test whether two items are equal.
  7185.      * @param {Array} list The array to consider.
  7186.      * @return {Array} `list` without repeating elements.
  7187.      * @see R.transduce
  7188.      * @example
  7189.      *
  7190.      *      var l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3];
  7191.      *      R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3]
  7192.      */
  7193.     var dropRepeatsWith = _curry2(_dispatchable([], _xdropRepeatsWith, function dropRepeatsWith(pred, list) {
  7194.         var result = [];
  7195.         var idx = 1;
  7196.         var len = list.length;
  7197.         if (len !== 0) {
  7198.             result[0] = list[0];
  7199.             while (idx < len) {
  7200.                 if (!pred(last(result), list[idx])) {
  7201.                     result[result.length] = list[idx];
  7202.                 }
  7203.                 idx += 1;
  7204.             }
  7205.         }
  7206.         return result;
  7207.     }));
  7208.  
  7209.     /**
  7210.      * Takes a function and two values in its domain and returns `true` if the
  7211.      * values map to the same value in the codomain; `false` otherwise.
  7212.      *
  7213.      * @func
  7214.      * @memberOf R
  7215.      * @since v0.18.0
  7216.      * @category Relation
  7217.      * @sig (a -> b) -> a -> a -> Boolean
  7218.      * @param {Function} f
  7219.      * @param {*} x
  7220.      * @param {*} y
  7221.      * @return {Boolean}
  7222.      * @example
  7223.      *
  7224.      *      R.eqBy(Math.abs, 5, -5); //=> true
  7225.      */
  7226.     var eqBy = _curry3(function eqBy(f, x, y) {
  7227.         return equals(f(x), f(y));
  7228.     });
  7229.  
  7230.     /**
  7231.      * Reports whether two objects have the same value, in `R.equals` terms, for
  7232.      * the specified property. Useful as a curried predicate.
  7233.      *
  7234.      * @func
  7235.      * @memberOf R
  7236.      * @since v0.1.0
  7237.      * @category Object
  7238.      * @sig k -> {k: v} -> {k: v} -> Boolean
  7239.      * @param {String} prop The name of the property to compare
  7240.      * @param {Object} obj1
  7241.      * @param {Object} obj2
  7242.      * @return {Boolean}
  7243.      *
  7244.      * @example
  7245.      *
  7246.      *      var o1 = { a: 1, b: 2, c: 3, d: 4 };
  7247.      *      var o2 = { a: 10, b: 20, c: 3, d: 40 };
  7248.      *      R.eqProps('a', o1, o2); //=> false
  7249.      *      R.eqProps('c', o1, o2); //=> true
  7250.      */
  7251.     var eqProps = _curry3(function eqProps(prop, obj1, obj2) {
  7252.         return equals(obj1[prop], obj2[prop]);
  7253.     });
  7254.  
  7255.     /**
  7256.      * Splits a list into sub-lists stored in an object, based on the result of
  7257.      * calling a String-returning function on each element, and grouping the
  7258.      * results according to values returned.
  7259.      *
  7260.      * Dispatches to the `groupBy` method of the second argument, if present.
  7261.      *
  7262.      * Acts as a transducer if a transformer is given in list position.
  7263.      *
  7264.      * @func
  7265.      * @memberOf R
  7266.      * @since v0.1.0
  7267.      * @category List
  7268.      * @sig (a -> String) -> [a] -> {String: [a]}
  7269.      * @param {Function} fn Function :: a -> String
  7270.      * @param {Array} list The array to group
  7271.      * @return {Object} An object with the output of `fn` for keys, mapped to arrays of elements
  7272.      *         that produced that key when passed to `fn`.
  7273.      * @see R.transduce
  7274.      * @example
  7275.      *
  7276.      *      var byGrade = R.groupBy(function(student) {
  7277.      *        var score = student.score;
  7278.      *        return score < 65 ? 'F' :
  7279.      *               score < 70 ? 'D' :
  7280.      *               score < 80 ? 'C' :
  7281.      *               score < 90 ? 'B' : 'A';
  7282.      *      });
  7283.      *      var students = [{name: 'Abby', score: 84},
  7284.      *                      {name: 'Eddy', score: 58},
  7285.      *                      // ...
  7286.      *                      {name: 'Jack', score: 69}];
  7287.      *      byGrade(students);
  7288.      *      // {
  7289.      *      //   'A': [{name: 'Dianne', score: 99}],
  7290.      *      //   'B': [{name: 'Abby', score: 84}]
  7291.      *      //   // ...,
  7292.      *      //   'F': [{name: 'Eddy', score: 58}]
  7293.      *      // }
  7294.      */
  7295.     var groupBy = _curry2(_checkForMethod('groupBy', reduceBy(function (acc, item) {
  7296.         if (acc == null) {
  7297.             acc = [];
  7298.         }
  7299.         acc.push(item);
  7300.         return acc;
  7301.     }, null)));
  7302.  
  7303.     /**
  7304.      * Given a function that generates a key, turns a list of objects into an
  7305.      * object indexing the objects by the given key. Note that if multiple
  7306.      * objects generate the same value for the indexing key only the last value
  7307.      * will be included in the generated object.
  7308.      *
  7309.      * Acts as a transducer if a transformer is given in list position.
  7310.      *
  7311.      * @func
  7312.      * @memberOf R
  7313.      * @since v0.19.0
  7314.      * @category List
  7315.      * @sig (a -> String) -> [{k: v}] -> {k: {k: v}}
  7316.      * @param {Function} fn Function :: a -> String
  7317.      * @param {Array} array The array of objects to index
  7318.      * @return {Object} An object indexing each array element by the given property.
  7319.      * @example
  7320.      *
  7321.      *      var list = [{id: 'xyz', title: 'A'}, {id: 'abc', title: 'B'}];
  7322.      *      R.indexBy(R.prop('id'), list);
  7323.      *      //=> {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}}
  7324.      */
  7325.     var indexBy = reduceBy(function (acc, elem) {
  7326.         return elem;
  7327.     }, null);
  7328.  
  7329.     /**
  7330.      * Returns the position of the first occurrence of an item in an array, or -1
  7331.      * if the item is not included in the array. `R.equals` is used to determine
  7332.      * equality.
  7333.      *
  7334.      * @func
  7335.      * @memberOf R
  7336.      * @since v0.1.0
  7337.      * @category List
  7338.      * @sig a -> [a] -> Number
  7339.      * @param {*} target The item to find.
  7340.      * @param {Array} xs The array to search in.
  7341.      * @return {Number} the index of the target, or -1 if the target is not found.
  7342.      * @see R.lastIndexOf
  7343.      * @example
  7344.      *
  7345.      *      R.indexOf(3, [1,2,3,4]); //=> 2
  7346.      *      R.indexOf(10, [1,2,3,4]); //=> -1
  7347.      */
  7348.     var indexOf = _curry2(function indexOf(target, xs) {
  7349.         return typeof xs.indexOf === 'function' && !_isArray(xs) ? xs.indexOf(target) : _indexOf(xs, target, 0);
  7350.     });
  7351.  
  7352.     /**
  7353.      * juxt applies a list of functions to a list of values.
  7354.      *
  7355.      * @func
  7356.      * @memberOf R
  7357.      * @since v0.19.0
  7358.      * @category Function
  7359.      * @sig [(a, b, ..., m) -> n] -> ((a, b, ..., m) -> [n])
  7360.      * @param {Array} fns An array of functions
  7361.      * @return {Function} A function that returns a list of values after applying each of the original `fns` to its parameters.
  7362.      * @see R.applySpec
  7363.      * @example
  7364.      *
  7365.      *      var getRange = R.juxt([Math.min, Math.max]);
  7366.      *      getRange(3, 4, 9, -3); //=> [-3, 9]
  7367.      * @symb R.juxt([f, g, h])(a, b) = [f(a, b), g(a, b), h(a, b)]
  7368.      */
  7369.     var juxt = _curry1(function juxt(fns) {
  7370.         return converge(function () {
  7371.             return Array.prototype.slice.call(arguments, 0);
  7372.         }, fns);
  7373.     });
  7374.  
  7375.     /**
  7376.      * Returns a lens for the given getter and setter functions. The getter "gets"
  7377.      * the value of the focus; the setter "sets" the value of the focus. The setter
  7378.      * should not mutate the data structure.
  7379.      *
  7380.      * @func
  7381.      * @memberOf R
  7382.      * @since v0.8.0
  7383.      * @category Object
  7384.      * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
  7385.      * @sig (s -> a) -> ((a, s) -> s) -> Lens s a
  7386.      * @param {Function} getter
  7387.      * @param {Function} setter
  7388.      * @return {Lens}
  7389.      * @see R.view, R.set, R.over, R.lensIndex, R.lensProp
  7390.      * @example
  7391.      *
  7392.      *      var xLens = R.lens(R.prop('x'), R.assoc('x'));
  7393.      *
  7394.      *      R.view(xLens, {x: 1, y: 2});            //=> 1
  7395.      *      R.set(xLens, 4, {x: 1, y: 2});          //=> {x: 4, y: 2}
  7396.      *      R.over(xLens, R.negate, {x: 1, y: 2});  //=> {x: -1, y: 2}
  7397.      */
  7398.     var lens = _curry2(function lens(getter, setter) {
  7399.         return function (toFunctorFn) {
  7400.             return function (target) {
  7401.                 return map(function (focus) {
  7402.                     return setter(focus, target);
  7403.                 }, toFunctorFn(getter(target)));
  7404.             };
  7405.         };
  7406.     });
  7407.  
  7408.     /**
  7409.      * Returns a lens whose focus is the specified index.
  7410.      *
  7411.      * @func
  7412.      * @memberOf R
  7413.      * @since v0.14.0
  7414.      * @category Object
  7415.      * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
  7416.      * @sig Number -> Lens s a
  7417.      * @param {Number} n
  7418.      * @return {Lens}
  7419.      * @see R.view, R.set, R.over
  7420.      * @example
  7421.      *
  7422.      *      var headLens = R.lensIndex(0);
  7423.      *
  7424.      *      R.view(headLens, ['a', 'b', 'c']);            //=> 'a'
  7425.      *      R.set(headLens, 'x', ['a', 'b', 'c']);        //=> ['x', 'b', 'c']
  7426.      *      R.over(headLens, R.toUpper, ['a', 'b', 'c']); //=> ['A', 'b', 'c']
  7427.      */
  7428.     var lensIndex = _curry1(function lensIndex(n) {
  7429.         return lens(nth(n), update(n));
  7430.     });
  7431.  
  7432.     /**
  7433.      * Returns a lens whose focus is the specified path.
  7434.      *
  7435.      * @func
  7436.      * @memberOf R
  7437.      * @since v0.19.0
  7438.      * @category Object
  7439.      * @typedefn Idx = String | Int
  7440.      * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
  7441.      * @sig [Idx] -> Lens s a
  7442.      * @param {Array} path The path to use.
  7443.      * @return {Lens}
  7444.      * @see R.view, R.set, R.over
  7445.      * @example
  7446.      *
  7447.      *      var xHeadYLens = R.lensPath(['x', 0, 'y']);
  7448.      *
  7449.      *      R.view(xHeadYLens, {x: [{y: 2, z: 3}, {y: 4, z: 5}]});
  7450.      *      //=> 2
  7451.      *      R.set(xHeadYLens, 1, {x: [{y: 2, z: 3}, {y: 4, z: 5}]});
  7452.      *      //=> {x: [{y: 1, z: 3}, {y: 4, z: 5}]}
  7453.      *      R.over(xHeadYLens, R.negate, {x: [{y: 2, z: 3}, {y: 4, z: 5}]});
  7454.      *      //=> {x: [{y: -2, z: 3}, {y: 4, z: 5}]}
  7455.      */
  7456.     var lensPath = _curry1(function lensPath(p) {
  7457.         return lens(path(p), assocPath(p));
  7458.     });
  7459.  
  7460.     /**
  7461.      * Returns a lens whose focus is the specified property.
  7462.      *
  7463.      * @func
  7464.      * @memberOf R
  7465.      * @since v0.14.0
  7466.      * @category Object
  7467.      * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
  7468.      * @sig String -> Lens s a
  7469.      * @param {String} k
  7470.      * @return {Lens}
  7471.      * @see R.view, R.set, R.over
  7472.      * @example
  7473.      *
  7474.      *      var xLens = R.lensProp('x');
  7475.      *
  7476.      *      R.view(xLens, {x: 1, y: 2});            //=> 1
  7477.      *      R.set(xLens, 4, {x: 1, y: 2});          //=> {x: 4, y: 2}
  7478.      *      R.over(xLens, R.negate, {x: 1, y: 2});  //=> {x: -1, y: 2}
  7479.      */
  7480.     var lensProp = _curry1(function lensProp(k) {
  7481.         return lens(prop(k), assoc(k));
  7482.     });
  7483.  
  7484.     /**
  7485.      * "lifts" a function to be the specified arity, so that it may "map over" that
  7486.      * many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).
  7487.      *
  7488.      * @func
  7489.      * @memberOf R
  7490.      * @since v0.7.0
  7491.      * @category Function
  7492.      * @sig Number -> (*... -> *) -> ([*]... -> [*])
  7493.      * @param {Function} fn The function to lift into higher context
  7494.      * @return {Function} The lifted function.
  7495.      * @see R.lift, R.ap
  7496.      * @example
  7497.      *
  7498.      *      var madd3 = R.liftN(3, (...args) => R.sum(args));
  7499.      *      madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]
  7500.      */
  7501.     var liftN = _curry2(function liftN(arity, fn) {
  7502.         var lifted = curryN(arity, fn);
  7503.         return curryN(arity, function () {
  7504.             return _reduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1));
  7505.         });
  7506.     });
  7507.  
  7508.     /**
  7509.      * Returns the mean of the given list of numbers.
  7510.      *
  7511.      * @func
  7512.      * @memberOf R
  7513.      * @since v0.14.0
  7514.      * @category Math
  7515.      * @sig [Number] -> Number
  7516.      * @param {Array} list
  7517.      * @return {Number}
  7518.      * @example
  7519.      *
  7520.      *      R.mean([2, 7, 9]); //=> 6
  7521.      *      R.mean([]); //=> NaN
  7522.      */
  7523.     var mean = _curry1(function mean(list) {
  7524.         return sum(list) / list.length;
  7525.     });
  7526.  
  7527.     /**
  7528.      * Returns the median of the given list of numbers.
  7529.      *
  7530.      * @func
  7531.      * @memberOf R
  7532.      * @since v0.14.0
  7533.      * @category Math
  7534.      * @sig [Number] -> Number
  7535.      * @param {Array} list
  7536.      * @return {Number}
  7537.      * @example
  7538.      *
  7539.      *      R.median([2, 9, 7]); //=> 7
  7540.      *      R.median([7, 2, 10, 9]); //=> 8
  7541.      *      R.median([]); //=> NaN
  7542.      */
  7543.     var median = _curry1(function median(list) {
  7544.         var len = list.length;
  7545.         if (len === 0) {
  7546.             return NaN;
  7547.         }
  7548.         var width = 2 - len % 2;
  7549.         var idx = (len - width) / 2;
  7550.         return mean(Array.prototype.slice.call(list, 0).sort(function (a, b) {
  7551.             return a < b ? -1 : a > b ? 1 : 0;
  7552.         }).slice(idx, idx + width));
  7553.     });
  7554.  
  7555.     /**
  7556.      * Takes a predicate and a list or other "filterable" object and returns the
  7557.      * pair of filterable objects of the same type of elements which do and do not
  7558.      * satisfy, the predicate, respectively.
  7559.      *
  7560.      * @func
  7561.      * @memberOf R
  7562.      * @since v0.1.4
  7563.      * @category List
  7564.      * @sig Filterable f => (a -> Boolean) -> f a -> [f a, f a]
  7565.      * @param {Function} pred A predicate to determine which side the element belongs to.
  7566.      * @param {Array} filterable the list (or other filterable) to partition.
  7567.      * @return {Array} An array, containing first the subset of elements that satisfy the
  7568.      *         predicate, and second the subset of elements that do not satisfy.
  7569.      * @see R.filter, R.reject
  7570.      * @example
  7571.      *
  7572.      *      R.partition(R.contains('s'), ['sss', 'ttt', 'foo', 'bars']);
  7573.      *      // => [ [ 'sss', 'bars' ],  [ 'ttt', 'foo' ] ]
  7574.      *
  7575.      *      R.partition(R.contains('s'), { a: 'sss', b: 'ttt', foo: 'bars' });
  7576.      *      // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' }  ]
  7577.      */
  7578.     var partition = juxt([
  7579.         filter,
  7580.         reject
  7581.     ]);
  7582.  
  7583.     /**
  7584.      * Performs left-to-right function composition. The leftmost function may have
  7585.      * any arity; the remaining functions must be unary.
  7586.      *
  7587.      * In some libraries this function is named `sequence`.
  7588.      *
  7589.      * **Note:** The result of pipe is not automatically curried.
  7590.      *
  7591.      * @func
  7592.      * @memberOf R
  7593.      * @since v0.1.0
  7594.      * @category Function
  7595.      * @sig (((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)) -> ((a, b, ..., n) -> z)
  7596.      * @param {...Function} functions
  7597.      * @return {Function}
  7598.      * @see R.compose
  7599.      * @example
  7600.      *
  7601.      *      var f = R.pipe(Math.pow, R.negate, R.inc);
  7602.      *
  7603.      *      f(3, 4); // -(3^4) + 1
  7604.      * @symb R.pipe(f, g, h)(a, b) = h(g(f(a, b)))
  7605.      */
  7606.     var pipe = function pipe() {
  7607.         if (arguments.length === 0) {
  7608.             throw new Error('pipe requires at least one argument');
  7609.         }
  7610.         return _arity(arguments[0].length, reduce(_pipe, arguments[0], tail(arguments)));
  7611.     };
  7612.  
  7613.     /**
  7614.      * Performs left-to-right composition of one or more Promise-returning
  7615.      * functions. The leftmost function may have any arity; the remaining functions
  7616.      * must be unary.
  7617.      *
  7618.      * @func
  7619.      * @memberOf R
  7620.      * @since v0.10.0
  7621.      * @category Function
  7622.      * @sig ((a -> Promise b), (b -> Promise c), ..., (y -> Promise z)) -> (a -> Promise z)
  7623.      * @param {...Function} functions
  7624.      * @return {Function}
  7625.      * @see R.composeP
  7626.      * @example
  7627.      *
  7628.      *      //  followersForUser :: String -> Promise [User]
  7629.      *      var followersForUser = R.pipeP(db.getUserById, db.getFollowers);
  7630.      */
  7631.     var pipeP = function pipeP() {
  7632.         if (arguments.length === 0) {
  7633.             throw new Error('pipeP requires at least one argument');
  7634.         }
  7635.         return _arity(arguments[0].length, reduce(_pipeP, arguments[0], tail(arguments)));
  7636.     };
  7637.  
  7638.     /**
  7639.      * Multiplies together all the elements of a list.
  7640.      *
  7641.      * @func
  7642.      * @memberOf R
  7643.      * @since v0.1.0
  7644.      * @category Math
  7645.      * @sig [Number] -> Number
  7646.      * @param {Array} list An array of numbers
  7647.      * @return {Number} The product of all the numbers in the list.
  7648.      * @see R.reduce
  7649.      * @example
  7650.      *
  7651.      *      R.product([2,4,6,8,100,1]); //=> 38400
  7652.      */
  7653.     var product = reduce(multiply, 1);
  7654.  
  7655.     /**
  7656.      * Transforms a [Traversable](https://github.com/fantasyland/fantasy-land#traversable)
  7657.      * of [Applicative](https://github.com/fantasyland/fantasy-land#applicative) into an
  7658.      * Applicative of Traversable.
  7659.      *
  7660.      * Dispatches to the `sequence` method of the second argument, if present.
  7661.      *
  7662.      * @func
  7663.      * @memberOf R
  7664.      * @since v0.19.0
  7665.      * @category List
  7666.      * @sig (Applicative f, Traversable t) => (a -> f a) -> t (f a) -> f (t a)
  7667.      * @param {Function} of
  7668.      * @param {*} traversable
  7669.      * @return {*}
  7670.      * @see R.traverse
  7671.      * @example
  7672.      *
  7673.      *      R.sequence(Maybe.of, [Just(1), Just(2), Just(3)]);   //=> Just([1, 2, 3])
  7674.      *      R.sequence(Maybe.of, [Just(1), Just(2), Nothing()]); //=> Nothing()
  7675.      *
  7676.      *      R.sequence(R.of, Just([1, 2, 3])); //=> [Just(1), Just(2), Just(3)]
  7677.      *      R.sequence(R.of, Nothing());       //=> [Nothing()]
  7678.      */
  7679.     var sequence = _curry2(function sequence(of, traversable) {
  7680.         return typeof traversable.sequence === 'function' ? traversable.sequence(of) : reduceRight(function (x, acc) {
  7681.             return ap(map(prepend, x), acc);
  7682.         }, of([]), traversable);
  7683.     });
  7684.  
  7685.     /**
  7686.      * Maps an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning
  7687.      * function over a [Traversable](https://github.com/fantasyland/fantasy-land#traversable),
  7688.      * then uses [`sequence`](#sequence) to transform the resulting Traversable of Applicative
  7689.      * into an Applicative of Traversable.
  7690.      *
  7691.      * Dispatches to the `sequence` method of the third argument, if present.
  7692.      *
  7693.      * @func
  7694.      * @memberOf R
  7695.      * @since v0.19.0
  7696.      * @category List
  7697.      * @sig (Applicative f, Traversable t) => (a -> f a) -> (a -> f b) -> t a -> f (t b)
  7698.      * @param {Function} of
  7699.      * @param {Function} f
  7700.      * @param {*} traversable
  7701.      * @return {*}
  7702.      * @see R.sequence
  7703.      * @example
  7704.      *
  7705.      *      // Returns `Nothing` if the given divisor is `0`
  7706.      *      safeDiv = n => d => d === 0 ? Nothing() : Just(n / d)
  7707.      *
  7708.      *      R.traverse(Maybe.of, safeDiv(10), [2, 4, 5]); //=> Just([5, 2.5, 2])
  7709.      *      R.traverse(Maybe.of, safeDiv(10), [2, 0, 5]); //=> Nothing
  7710.      */
  7711.     var traverse = _curry3(function traverse(of, f, traversable) {
  7712.         return sequence(of, map(f, traversable));
  7713.     });
  7714.  
  7715.     /**
  7716.      * Shorthand for `R.chain(R.identity)`, which removes one level of nesting from
  7717.      * any [Chain](https://github.com/fantasyland/fantasy-land#chain).
  7718.      *
  7719.      * @func
  7720.      * @memberOf R
  7721.      * @since v0.3.0
  7722.      * @category List
  7723.      * @sig Chain c => c (c a) -> c a
  7724.      * @param {*} list
  7725.      * @return {*}
  7726.      * @see R.flatten, R.chain
  7727.      * @example
  7728.      *
  7729.      *      R.unnest([1, [2], [[3]]]); //=> [1, 2, [3]]
  7730.      *      R.unnest([[1, 2], [3, 4], [5, 6]]); //=> [1, 2, 3, 4, 5, 6]
  7731.      */
  7732.     var unnest = chain(_identity);
  7733.  
  7734.     var _contains = function _contains(a, list) {
  7735.         return _indexOf(list, a, 0) >= 0;
  7736.     };
  7737.  
  7738.     //  mapPairs :: (Object, [String]) -> [String]
  7739.     var _toString = function _toString(x, seen) {
  7740.         var recur = function recur(y) {
  7741.             var xs = seen.concat([x]);
  7742.             return _contains(y, xs) ? '<Circular>' : _toString(y, xs);
  7743.         };
  7744.         //  mapPairs :: (Object, [String]) -> [String]
  7745.         var mapPairs = function (obj, keys) {
  7746.             return _map(function (k) {
  7747.                 return _quote(k) + ': ' + recur(obj[k]);
  7748.             }, keys.slice().sort());
  7749.         };
  7750.         switch (Object.prototype.toString.call(x)) {
  7751.         case '[object Arguments]':
  7752.             return '(function() { return arguments; }(' + _map(recur, x).join(', ') + '))';
  7753.         case '[object Array]':
  7754.             return '[' + _map(recur, x).concat(mapPairs(x, reject(function (k) {
  7755.                 return /^\d+$/.test(k);
  7756.             }, keys(x)))).join(', ') + ']';
  7757.         case '[object Boolean]':
  7758.             return typeof x === 'object' ? 'new Boolean(' + recur(x.valueOf()) + ')' : x.toString();
  7759.         case '[object Date]':
  7760.             return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString(x))) + ')';
  7761.         case '[object Null]':
  7762.             return 'null';
  7763.         case '[object Number]':
  7764.             return typeof x === 'object' ? 'new Number(' + recur(x.valueOf()) + ')' : 1 / x === -Infinity ? '-0' : x.toString(10);
  7765.         case '[object String]':
  7766.             return typeof x === 'object' ? 'new String(' + recur(x.valueOf()) + ')' : _quote(x);
  7767.         case '[object Undefined]':
  7768.             return 'undefined';
  7769.         default:
  7770.             if (typeof x.toString === 'function') {
  7771.                 var repr = x.toString();
  7772.                 if (repr !== '[object Object]') {
  7773.                     return repr;
  7774.                 }
  7775.             }
  7776.             return '{' + mapPairs(x, keys(x)).join(', ') + '}';
  7777.         }
  7778.     };
  7779.  
  7780.     /**
  7781.      * Performs right-to-left function composition. The rightmost function may have
  7782.      * any arity; the remaining functions must be unary.
  7783.      *
  7784.      * **Note:** The result of compose is not automatically curried.
  7785.      *
  7786.      * @func
  7787.      * @memberOf R
  7788.      * @since v0.1.0
  7789.      * @category Function
  7790.      * @sig ((y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)) -> ((a, b, ..., n) -> z)
  7791.      * @param {...Function} ...functions The functions to compose
  7792.      * @return {Function}
  7793.      * @see R.pipe
  7794.      * @example
  7795.      *
  7796.      *      var classyGreeting = (firstName, lastName) => "The name's " + lastName + ", " + firstName + " " + lastName
  7797.      *      var yellGreeting = R.compose(R.toUpper, classyGreeting);
  7798.      *      yellGreeting('James', 'Bond'); //=> "THE NAME'S BOND, JAMES BOND"
  7799.      *
  7800.      *      R.compose(Math.abs, R.add(1), R.multiply(2))(-4) //=> 7
  7801.      *
  7802.      * @symb R.compose(f, g, h)(a, b) = f(g(h(a, b)))
  7803.      */
  7804.     var compose = function compose() {
  7805.         if (arguments.length === 0) {
  7806.             throw new Error('compose requires at least one argument');
  7807.         }
  7808.         return pipe.apply(this, reverse(arguments));
  7809.     };
  7810.  
  7811.     /**
  7812.      * Returns the right-to-left Kleisli composition of the provided functions,
  7813.      * each of which must return a value of a type supported by [`chain`](#chain).
  7814.      *
  7815.      * `R.composeK(h, g, f)` is equivalent to `R.compose(R.chain(h), R.chain(g), R.chain(f))`.
  7816.      *
  7817.      * @func
  7818.      * @memberOf R
  7819.      * @since v0.16.0
  7820.      * @category Function
  7821.      * @sig Chain m => ((y -> m z), (x -> m y), ..., (a -> m b)) -> (a -> m z)
  7822.      * @param {...Function} ...functions The functions to compose
  7823.      * @return {Function}
  7824.      * @see R.pipeK
  7825.      * @example
  7826.      *
  7827.      *       //  get :: String -> Object -> Maybe *
  7828.      *       var get = R.curry((propName, obj) => Maybe(obj[propName]))
  7829.      *
  7830.      *       //  getStateCode :: Maybe String -> Maybe String
  7831.      *       var getStateCode = R.composeK(
  7832.      *         R.compose(Maybe.of, R.toUpper),
  7833.      *         get('state'),
  7834.      *         get('address'),
  7835.      *         get('user'),
  7836.      *       );
  7837.      *       getStateCode({"user":{"address":{"state":"ny"}}}); //=> Maybe.Just("NY")
  7838.      *       getStateCode({}); //=> Maybe.Nothing()
  7839.      * @symb R.composeK(f, g, h)(a) = R.chain(f, R.chain(g, h(a)))
  7840.      */
  7841.     var composeK = function composeK() {
  7842.         if (arguments.length === 0) {
  7843.             throw new Error('composeK requires at least one argument');
  7844.         }
  7845.         var init = Array.prototype.slice.call(arguments);
  7846.         var last = init.pop();
  7847.         return compose(compose.apply(this, map(chain, init)), last);
  7848.     };
  7849.  
  7850.     /**
  7851.      * Performs right-to-left composition of one or more Promise-returning
  7852.      * functions. The rightmost function may have any arity; the remaining
  7853.      * functions must be unary.
  7854.      *
  7855.      * @func
  7856.      * @memberOf R
  7857.      * @since v0.10.0
  7858.      * @category Function
  7859.      * @sig ((y -> Promise z), (x -> Promise y), ..., (a -> Promise b)) -> (a -> Promise z)
  7860.      * @param {...Function} functions The functions to compose
  7861.      * @return {Function}
  7862.      * @see R.pipeP
  7863.      * @example
  7864.      *
  7865.      *      var db = {
  7866.      *        users: {
  7867.      *          JOE: {
  7868.      *            name: 'Joe',
  7869.      *            followers: ['STEVE', 'SUZY']
  7870.      *          }
  7871.      *        }
  7872.      *      }
  7873.      *
  7874.      *      // We'll pretend to do a db lookup which returns a promise
  7875.      *      var lookupUser = (userId) => Promise.resolve(db.users[userId])
  7876.      *      var lookupFollowers = (user) => Promise.resolve(user.followers)
  7877.      *      lookupUser('JOE').then(lookupFollowers)
  7878.      *
  7879.      *      //  followersForUser :: String -> Promise [UserId]
  7880.      *      var followersForUser = R.composeP(lookupFollowers, lookupUser);
  7881.      *      followersForUser('JOE').then(followers => console.log('Followers:', followers))
  7882.      *      // Followers: ["STEVE","SUZY"]
  7883.      */
  7884.     var composeP = function composeP() {
  7885.         if (arguments.length === 0) {
  7886.             throw new Error('composeP requires at least one argument');
  7887.         }
  7888.         return pipeP.apply(this, reverse(arguments));
  7889.     };
  7890.  
  7891.     /**
  7892.      * Wraps a constructor function inside a curried function that can be called
  7893.      * with the same arguments and returns the same type.
  7894.      *
  7895.      * @func
  7896.      * @memberOf R
  7897.      * @since v0.1.0
  7898.      * @category Function
  7899.      * @sig (* -> {*}) -> (* -> {*})
  7900.      * @param {Function} fn The constructor function to wrap.
  7901.      * @return {Function} A wrapped, curried constructor function.
  7902.      * @example
  7903.      *
  7904.      *      // Constructor function
  7905.      *      function Animal(kind) {
  7906.      *        this.kind = kind;
  7907.      *      };
  7908.      *      Animal.prototype.sighting = function() {
  7909.      *        return "It's a " + this.kind + "!";
  7910.      *      }
  7911.      *
  7912.      *      var AnimalConstructor = R.construct(Animal)
  7913.      *
  7914.      *      // Notice we no longer need the 'new' keyword:
  7915.      *      AnimalConstructor('Pig'); //=> {"kind": "Pig", "sighting": function (){...}};
  7916.      *
  7917.      *      var animalTypes = ["Lion", "Tiger", "Bear"];
  7918.      *      var animalSighting = R.invoker(0, 'sighting');
  7919.      *      var sightNewAnimal = R.compose(animalSighting, AnimalConstructor);
  7920.      *      R.map(sightNewAnimal, animalTypes); //=> ["It's a Lion!", "It's a Tiger!", "It's a Bear!"]
  7921.      */
  7922.     var construct = _curry1(function construct(Fn) {
  7923.         return constructN(Fn.length, Fn);
  7924.     });
  7925.  
  7926.     /**
  7927.      * Returns `true` if the specified value is equal, in `R.equals` terms, to at
  7928.      * least one element of the given list; `false` otherwise.
  7929.      *
  7930.      * @func
  7931.      * @memberOf R
  7932.      * @since v0.1.0
  7933.      * @category List
  7934.      * @sig a -> [a] -> Boolean
  7935.      * @param {Object} a The item to compare against.
  7936.      * @param {Array} list The array to consider.
  7937.      * @return {Boolean} `true` if an equivalent item is in the list, `false` otherwise.
  7938.      * @see R.any
  7939.      * @example
  7940.      *
  7941.      *      R.contains(3, [1, 2, 3]); //=> true
  7942.      *      R.contains(4, [1, 2, 3]); //=> false
  7943.      *      R.contains({ name: 'Fred' }, [{ name: 'Fred' }]); //=> true
  7944.      *      R.contains([42], [[42]]); //=> true
  7945.      */
  7946.     var contains = _curry2(_contains);
  7947.  
  7948.     /**
  7949.      * Finds the set (i.e. no duplicates) of all elements in the first list not
  7950.      * contained in the second list. Objects and Arrays are compared are compared
  7951.      * in terms of value equality, not reference equality.
  7952.      *
  7953.      * @func
  7954.      * @memberOf R
  7955.      * @since v0.1.0
  7956.      * @category Relation
  7957.      * @sig [*] -> [*] -> [*]
  7958.      * @param {Array} list1 The first list.
  7959.      * @param {Array} list2 The second list.
  7960.      * @return {Array} The elements in `list1` that are not in `list2`.
  7961.      * @see R.differenceWith, R.symmetricDifference, R.symmetricDifferenceWith
  7962.      * @example
  7963.      *
  7964.      *      R.difference([1,2,3,4], [7,6,5,4,3]); //=> [1,2]
  7965.      *      R.difference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5]
  7966.      *      R.difference([{a: 1}, {b: 2}], [{a: 1}, {c: 3}]) //=> [{b: 2}]
  7967.      */
  7968.     var difference = _curry2(function difference(first, second) {
  7969.         var out = [];
  7970.         var idx = 0;
  7971.         var firstLen = first.length;
  7972.         while (idx < firstLen) {
  7973.             if (!_contains(first[idx], second) && !_contains(first[idx], out)) {
  7974.                 out[out.length] = first[idx];
  7975.             }
  7976.             idx += 1;
  7977.         }
  7978.         return out;
  7979.     });
  7980.  
  7981.     /**
  7982.      * Returns a new list without any consecutively repeating elements. `R.equals`
  7983.      * is used to determine equality.
  7984.      *
  7985.      * Acts as a transducer if a transformer is given in list position.
  7986.      *
  7987.      * @func
  7988.      * @memberOf R
  7989.      * @since v0.14.0
  7990.      * @category List
  7991.      * @sig [a] -> [a]
  7992.      * @param {Array} list The array to consider.
  7993.      * @return {Array} `list` without repeating elements.
  7994.      * @see R.transduce
  7995.      * @example
  7996.      *
  7997.      *     R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2]
  7998.      */
  7999.     var dropRepeats = _curry1(_dispatchable([], _xdropRepeatsWith(equals), dropRepeatsWith(equals)));
  8000.  
  8001.     /**
  8002.      * "lifts" a function of arity > 1 so that it may "map over" a list, Function or other
  8003.      * object that satisfies the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).
  8004.      *
  8005.      * @func
  8006.      * @memberOf R
  8007.      * @since v0.7.0
  8008.      * @category Function
  8009.      * @sig (*... -> *) -> ([*]... -> [*])
  8010.      * @param {Function} fn The function to lift into higher context
  8011.      * @return {Function} The lifted function.
  8012.      * @see R.liftN
  8013.      * @example
  8014.      *
  8015.      *      var madd3 = R.lift((a, b, c) => a + b + c);
  8016.      *
  8017.      *      madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]
  8018.      *
  8019.      *      var madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e);
  8020.      *
  8021.      *      madd5([1,2], [3], [4, 5], [6], [7, 8]); //=> [21, 22, 22, 23, 22, 23, 23, 24]
  8022.      */
  8023.     var lift = _curry1(function lift(fn) {
  8024.         return liftN(fn.length, fn);
  8025.     });
  8026.  
  8027.     /**
  8028.      * Returns a partial copy of an object omitting the keys specified.
  8029.      *
  8030.      * @func
  8031.      * @memberOf R
  8032.      * @since v0.1.0
  8033.      * @category Object
  8034.      * @sig [String] -> {String: *} -> {String: *}
  8035.      * @param {Array} names an array of String property names to omit from the new object
  8036.      * @param {Object} obj The object to copy from
  8037.      * @return {Object} A new object with properties from `names` not on it.
  8038.      * @see R.pick
  8039.      * @example
  8040.      *
  8041.      *      R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, c: 3}
  8042.      */
  8043.     var omit = _curry2(function omit(names, obj) {
  8044.         var result = {};
  8045.         for (var prop in obj) {
  8046.             if (!_contains(prop, names)) {
  8047.                 result[prop] = obj[prop];
  8048.             }
  8049.         }
  8050.         return result;
  8051.     });
  8052.  
  8053.     /**
  8054.      * Returns the left-to-right Kleisli composition of the provided functions,
  8055.      * each of which must return a value of a type supported by [`chain`](#chain).
  8056.      *
  8057.      * `R.pipeK(f, g, h)` is equivalent to `R.pipe(R.chain(f), R.chain(g), R.chain(h))`.
  8058.      *
  8059.      * @func
  8060.      * @memberOf R
  8061.      * @since v0.16.0
  8062.      * @category Function
  8063.      * @sig Chain m => ((a -> m b), (b -> m c), ..., (y -> m z)) -> (a -> m z)
  8064.      * @param {...Function}
  8065.      * @return {Function}
  8066.      * @see R.composeK
  8067.      * @example
  8068.      *
  8069.      *      //  parseJson :: String -> Maybe *
  8070.      *      //  get :: String -> Object -> Maybe *
  8071.      *
  8072.      *      //  getStateCode :: Maybe String -> Maybe String
  8073.      *      var getStateCode = R.pipeK(
  8074.      *        parseJson,
  8075.      *        get('user'),
  8076.      *        get('address'),
  8077.      *        get('state'),
  8078.      *        R.compose(Maybe.of, R.toUpper)
  8079.      *      );
  8080.      *
  8081.      *      getStateCode('{"user":{"address":{"state":"ny"}}}');
  8082.      *      //=> Just('NY')
  8083.      *      getStateCode('[Invalid JSON]');
  8084.      *      //=> Nothing()
  8085.      * @symb R.pipeK(f, g, h)(a) = R.chain(h, R.chain(g, f(a)))
  8086.      */
  8087.     var pipeK = function pipeK() {
  8088.         if (arguments.length === 0) {
  8089.             throw new Error('pipeK requires at least one argument');
  8090.         }
  8091.         return composeK.apply(this, reverse(arguments));
  8092.     };
  8093.  
  8094.     /**
  8095.      * Returns the string representation of the given value. `eval`'ing the output
  8096.      * should result in a value equivalent to the input value. Many of the built-in
  8097.      * `toString` methods do not satisfy this requirement.
  8098.      *
  8099.      * If the given value is an `[object Object]` with a `toString` method other
  8100.      * than `Object.prototype.toString`, this method is invoked with no arguments
  8101.      * to produce the return value. This means user-defined constructor functions
  8102.      * can provide a suitable `toString` method. For example:
  8103.      *
  8104.      *     function Point(x, y) {
  8105.      *       this.x = x;
  8106.      *       this.y = y;
  8107.      *     }
  8108.      *
  8109.      *     Point.prototype.toString = function() {
  8110.      *       return 'new Point(' + this.x + ', ' + this.y + ')';
  8111.      *     };
  8112.      *
  8113.      *     R.toString(new Point(1, 2)); //=> 'new Point(1, 2)'
  8114.      *
  8115.      * @func
  8116.      * @memberOf R
  8117.      * @since v0.14.0
  8118.      * @category String
  8119.      * @sig * -> String
  8120.      * @param {*} val
  8121.      * @return {String}
  8122.      * @example
  8123.      *
  8124.      *      R.toString(42); //=> '42'
  8125.      *      R.toString('abc'); //=> '"abc"'
  8126.      *      R.toString([1, 2, 3]); //=> '[1, 2, 3]'
  8127.      *      R.toString({foo: 1, bar: 2, baz: 3}); //=> '{"bar": 2, "baz": 3, "foo": 1}'
  8128.      *      R.toString(new Date('2001-02-03T04:05:06Z')); //=> 'new Date("2001-02-03T04:05:06.000Z")'
  8129.      */
  8130.     var toString = _curry1(function toString(val) {
  8131.         return _toString(val, []);
  8132.     });
  8133.  
  8134.     /**
  8135.      * Returns a new list without values in the first argument.
  8136.      * `R.equals` is used to determine equality.
  8137.      *
  8138.      * Acts as a transducer if a transformer is given in list position.
  8139.      *
  8140.      * @func
  8141.      * @memberOf R
  8142.      * @since v0.19.0
  8143.      * @category List
  8144.      * @sig [a] -> [a] -> [a]
  8145.      * @param {Array} list1 The values to be removed from `list2`.
  8146.      * @param {Array} list2 The array to remove values from.
  8147.      * @return {Array} The new array without values in `list1`.
  8148.      * @see R.transduce
  8149.      * @example
  8150.      *
  8151.      *      R.without([1, 2], [1, 2, 1, 3, 4]); //=> [3, 4]
  8152.      */
  8153.     var without = _curry2(function (xs, list) {
  8154.         return reject(flip(_contains)(xs), list);
  8155.     });
  8156.  
  8157.     // A simple Set type that honours R.equals semantics
  8158.     /* globals Set */
  8159.     // until we figure out why jsdoc chokes on this
  8160.     // @param item The item to add to the Set
  8161.     // @returns {boolean} true if the item did not exist prior, otherwise false
  8162.     //
  8163.     //
  8164.     // @param item The item to check for existence in the Set
  8165.     // @returns {boolean} true if the item exists in the Set, otherwise false
  8166.     //
  8167.     //
  8168.     // Combines the logic for checking whether an item is a member of the set and
  8169.     // for adding a new item to the set.
  8170.     //
  8171.     // @param item       The item to check or add to the Set instance.
  8172.     // @param shouldAdd  If true, the item will be added to the set if it doesn't
  8173.     //                   already exist.
  8174.     // @param set        The set instance to check or add to.
  8175.     // @return {boolean} true if the item already existed, otherwise false.
  8176.     //
  8177.     // distinguish between +0 and -0
  8178.     // these types can all utilise the native Set
  8179.     // set._items['boolean'] holds a two element array
  8180.     // representing [ falseExists, trueExists ]
  8181.     // compare functions for reference equality
  8182.     /* falls through */
  8183.     // reduce the search size of heterogeneous sets by creating buckets
  8184.     // for each type.
  8185.     // scan through all previously applied items
  8186.     var _Set = function () {
  8187.         function _Set() {
  8188.             /* globals Set */
  8189.             this._nativeSet = typeof Set === 'function' ? new Set() : null;
  8190.             this._items = {};
  8191.         }
  8192.         // until we figure out why jsdoc chokes on this
  8193.         // @param item The item to add to the Set
  8194.         // @returns {boolean} true if the item did not exist prior, otherwise false
  8195.         //
  8196.         _Set.prototype.add = function (item) {
  8197.             return !hasOrAdd(item, true, this);
  8198.         };
  8199.         //
  8200.         // @param item The item to check for existence in the Set
  8201.         // @returns {boolean} true if the item exists in the Set, otherwise false
  8202.         //
  8203.         _Set.prototype.has = function (item) {
  8204.             return hasOrAdd(item, false, this);
  8205.         };
  8206.         //
  8207.         // Combines the logic for checking whether an item is a member of the set and
  8208.         // for adding a new item to the set.
  8209.         //
  8210.         // @param item       The item to check or add to the Set instance.
  8211.         // @param shouldAdd  If true, the item will be added to the set if it doesn't
  8212.         //                   already exist.
  8213.         // @param set        The set instance to check or add to.
  8214.         // @return {boolean} true if the item already existed, otherwise false.
  8215.         //
  8216.         function hasOrAdd(item, shouldAdd, set) {
  8217.             var type = typeof item;
  8218.             var prevSize, newSize;
  8219.             switch (type) {
  8220.             case 'string':
  8221.             case 'number':
  8222.                 // distinguish between +0 and -0
  8223.                 if (item === 0 && 1 / item === -Infinity) {
  8224.                     if (set._items['-0']) {
  8225.                         return true;
  8226.                     } else {
  8227.                         if (shouldAdd) {
  8228.                             set._items['-0'] = true;
  8229.                         }
  8230.                         return false;
  8231.                     }
  8232.                 }
  8233.                 // these types can all utilise the native Set
  8234.                 if (set._nativeSet !== null) {
  8235.                     if (shouldAdd) {
  8236.                         prevSize = set._nativeSet.size;
  8237.                         set._nativeSet.add(item);
  8238.                         newSize = set._nativeSet.size;
  8239.                         return newSize === prevSize;
  8240.                     } else {
  8241.                         return set._nativeSet.has(item);
  8242.                     }
  8243.                 } else {
  8244.                     if (!(type in set._items)) {
  8245.                         if (shouldAdd) {
  8246.                             set._items[type] = {};
  8247.                             set._items[type][item] = true;
  8248.                         }
  8249.                         return false;
  8250.                     } else if (item in set._items[type]) {
  8251.                         return true;
  8252.                     } else {
  8253.                         if (shouldAdd) {
  8254.                             set._items[type][item] = true;
  8255.                         }
  8256.                         return false;
  8257.                     }
  8258.                 }
  8259.             case 'boolean':
  8260.                 // set._items['boolean'] holds a two element array
  8261.                 // representing [ falseExists, trueExists ]
  8262.                 if (type in set._items) {
  8263.                     var bIdx = item ? 1 : 0;
  8264.                     if (set._items[type][bIdx]) {
  8265.                         return true;
  8266.                     } else {
  8267.                         if (shouldAdd) {
  8268.                             set._items[type][bIdx] = true;
  8269.                         }
  8270.                         return false;
  8271.                     }
  8272.                 } else {
  8273.                     if (shouldAdd) {
  8274.                         set._items[type] = item ? [
  8275.                             false,
  8276.                             true
  8277.                         ] : [
  8278.                             true,
  8279.                             false
  8280.                         ];
  8281.                     }
  8282.                     return false;
  8283.                 }
  8284.             case 'function':
  8285.                 // compare functions for reference equality
  8286.                 if (set._nativeSet !== null) {
  8287.                     if (shouldAdd) {
  8288.                         prevSize = set._nativeSet.size;
  8289.                         set._nativeSet.add(item);
  8290.                         newSize = set._nativeSet.size;
  8291.                         return newSize === prevSize;
  8292.                     } else {
  8293.                         return set._nativeSet.has(item);
  8294.                     }
  8295.                 } else {
  8296.                     if (!(type in set._items)) {
  8297.                         if (shouldAdd) {
  8298.                             set._items[type] = [item];
  8299.                         }
  8300.                         return false;
  8301.                     }
  8302.                     if (!_contains(item, set._items[type])) {
  8303.                         if (shouldAdd) {
  8304.                             set._items[type].push(item);
  8305.                         }
  8306.                         return false;
  8307.                     }
  8308.                     return true;
  8309.                 }
  8310.             case 'undefined':
  8311.                 if (set._items[type]) {
  8312.                     return true;
  8313.                 } else {
  8314.                     if (shouldAdd) {
  8315.                         set._items[type] = true;
  8316.                     }
  8317.                     return false;
  8318.                 }
  8319.             case 'object':
  8320.                 if (item === null) {
  8321.                     if (!set._items['null']) {
  8322.                         if (shouldAdd) {
  8323.                             set._items['null'] = true;
  8324.                         }
  8325.                         return false;
  8326.                     }
  8327.                     return true;
  8328.                 }
  8329.             /* falls through */
  8330.             default:
  8331.                 // reduce the search size of heterogeneous sets by creating buckets
  8332.                 // for each type.
  8333.                 type = Object.prototype.toString.call(item);
  8334.                 if (!(type in set._items)) {
  8335.                     if (shouldAdd) {
  8336.                         set._items[type] = [item];
  8337.                     }
  8338.                     return false;
  8339.                 }
  8340.                 // scan through all previously applied items
  8341.                 if (!_contains(item, set._items[type])) {
  8342.                     if (shouldAdd) {
  8343.                         set._items[type].push(item);
  8344.                     }
  8345.                     return false;
  8346.                 }
  8347.                 return true;
  8348.             }
  8349.         }
  8350.         return _Set;
  8351.     }();
  8352.  
  8353.     /**
  8354.      * A function which calls the two provided functions and returns the `&&`
  8355.      * of the results.
  8356.      * It returns the result of the first function if it is false-y and the result
  8357.      * of the second function otherwise. Note that this is short-circuited,
  8358.      * meaning that the second function will not be invoked if the first returns a
  8359.      * false-y value.
  8360.      *
  8361.      * In addition to functions, `R.both` also accepts any fantasy-land compatible
  8362.      * applicative functor.
  8363.      *
  8364.      * @func
  8365.      * @memberOf R
  8366.      * @since v0.12.0
  8367.      * @category Logic
  8368.      * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean)
  8369.      * @param {Function} f A predicate
  8370.      * @param {Function} g Another predicate
  8371.      * @return {Function} a function that applies its arguments to `f` and `g` and `&&`s their outputs together.
  8372.      * @see R.and
  8373.      * @example
  8374.      *
  8375.      *      var gt10 = R.gt(R.__, 10)
  8376.      *      var lt20 = R.lt(R.__, 20)
  8377.      *      var f = R.both(gt10, lt20);
  8378.      *      f(15); //=> true
  8379.      *      f(30); //=> false
  8380.      */
  8381.     var both = _curry2(function both(f, g) {
  8382.         return _isFunction(f) ? function _both() {
  8383.             return f.apply(this, arguments) && g.apply(this, arguments);
  8384.         } : lift(and)(f, g);
  8385.     });
  8386.  
  8387.     /**
  8388.      * Takes a function `f` and returns a function `g` such that if called with the same arguments
  8389.      * when `f` returns a "truthy" value, `g` returns `false` and when `f` returns a "falsy" value `g` returns `true`.
  8390.      *
  8391.      * `R.complement` may be applied to any functor
  8392.      *
  8393.      * @func
  8394.      * @memberOf R
  8395.      * @since v0.12.0
  8396.      * @category Logic
  8397.      * @sig (*... -> *) -> (*... -> Boolean)
  8398.      * @param {Function} f
  8399.      * @return {Function}
  8400.      * @see R.not
  8401.      * @example
  8402.      *
  8403.      *      var isNotNil = R.complement(R.isNil);
  8404.      *      isNil(null); //=> true
  8405.      *      isNotNil(null); //=> false
  8406.      *      isNil(7); //=> false
  8407.      *      isNotNil(7); //=> true
  8408.      */
  8409.     var complement = lift(not);
  8410.  
  8411.     /**
  8412.      * Returns the result of concatenating the given lists or strings.
  8413.      *
  8414.      * Note: `R.concat` expects both arguments to be of the same type,
  8415.      * unlike the native `Array.prototype.concat` method. It will throw
  8416.      * an error if you `concat` an Array with a non-Array value.
  8417.      *
  8418.      * Dispatches to the `concat` method of the first argument, if present.
  8419.      *
  8420.      * @func
  8421.      * @memberOf R
  8422.      * @since v0.1.0
  8423.      * @category List
  8424.      * @sig [a] -> [a] -> [a]
  8425.      * @sig String -> String -> String
  8426.      * @param {Array|String} firstList The first list
  8427.      * @param {Array|String} secondList The second list
  8428.      * @return {Array|String} A list consisting of the elements of `firstList` followed by the elements of
  8429.      * `secondList`.
  8430.      *
  8431.      * @example
  8432.      *
  8433.      *      R.concat('ABC', 'DEF'); // 'ABCDEF'
  8434.      *      R.concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3]
  8435.      *      R.concat([], []); //=> []
  8436.      */
  8437.     var concat = _curry2(function concat(a, b) {
  8438.         if (a == null || !_isFunction(a.concat)) {
  8439.             throw new TypeError(toString(a) + ' does not have a method named "concat"');
  8440.         }
  8441.         if (_isArray(a) && !_isArray(b)) {
  8442.             throw new TypeError(toString(b) + ' is not an array');
  8443.         }
  8444.         return a.concat(b);
  8445.     });
  8446.  
  8447.     /**
  8448.      * A function wrapping calls to the two functions in an `||` operation,
  8449.      * returning the result of the first function if it is truth-y and the result
  8450.      * of the second function otherwise. Note that this is short-circuited,
  8451.      * meaning that the second function will not be invoked if the first returns a
  8452.      * truth-y value.
  8453.      *
  8454.      * In addition to functions, `R.either` also accepts any fantasy-land compatible
  8455.      * applicative functor.
  8456.      *
  8457.      * @func
  8458.      * @memberOf R
  8459.      * @since v0.12.0
  8460.      * @category Logic
  8461.      * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean)
  8462.      * @param {Function} f a predicate
  8463.      * @param {Function} g another predicate
  8464.      * @return {Function} a function that applies its arguments to `f` and `g` and `||`s their outputs together.
  8465.      * @see R.or
  8466.      * @example
  8467.      *
  8468.      *      var gt10 = x => x > 10;
  8469.      *      var even = x => x % 2 === 0;
  8470.      *      var f = R.either(gt10, even);
  8471.      *      f(101); //=> true
  8472.      *      f(8); //=> true
  8473.      */
  8474.     var either = _curry2(function either(f, g) {
  8475.         return _isFunction(f) ? function _either() {
  8476.             return f.apply(this, arguments) || g.apply(this, arguments);
  8477.         } : lift(or)(f, g);
  8478.     });
  8479.  
  8480.     /**
  8481.      * Turns a named method with a specified arity into a function that can be
  8482.      * called directly supplied with arguments and a target object.
  8483.      *
  8484.      * The returned function is curried and accepts `arity + 1` parameters where
  8485.      * the final parameter is the target object.
  8486.      *
  8487.      * @func
  8488.      * @memberOf R
  8489.      * @since v0.1.0
  8490.      * @category Function
  8491.      * @sig Number -> String -> (a -> b -> ... -> n -> Object -> *)
  8492.      * @param {Number} arity Number of arguments the returned function should take
  8493.      *        before the target object.
  8494.      * @param {String} method Name of the method to call.
  8495.      * @return {Function} A new curried function.
  8496.      * @example
  8497.      *
  8498.      *      var sliceFrom = R.invoker(1, 'slice');
  8499.      *      sliceFrom(6, 'abcdefghijklm'); //=> 'ghijklm'
  8500.      *      var sliceFrom6 = R.invoker(2, 'slice')(6);
  8501.      *      sliceFrom6(8, 'abcdefghijklm'); //=> 'gh'
  8502.      * @symb R.invoker(0, 'method')(o) = o['method']()
  8503.      * @symb R.invoker(1, 'method')(a, o) = o['method'](a)
  8504.      * @symb R.invoker(2, 'method')(a, b, o) = o['method'](a, b)
  8505.      */
  8506.     var invoker = _curry2(function invoker(arity, method) {
  8507.         return curryN(arity + 1, function () {
  8508.             var target = arguments[arity];
  8509.             if (target != null && _isFunction(target[method])) {
  8510.                 return target[method].apply(target, Array.prototype.slice.call(arguments, 0, arity));
  8511.             }
  8512.             throw new TypeError(toString(target) + ' does not have a method named "' + method + '"');
  8513.         });
  8514.     });
  8515.  
  8516.     /**
  8517.      * Returns a string made by inserting the `separator` between each element and
  8518.      * concatenating all the elements into a single string.
  8519.      *
  8520.      * @func
  8521.      * @memberOf R
  8522.      * @since v0.1.0
  8523.      * @category List
  8524.      * @sig String -> [a] -> String
  8525.      * @param {Number|String} separator The string used to separate the elements.
  8526.      * @param {Array} xs The elements to join into a string.
  8527.      * @return {String} str The string made by concatenating `xs` with `separator`.
  8528.      * @see R.split
  8529.      * @example
  8530.      *
  8531.      *      var spacer = R.join(' ');
  8532.      *      spacer(['a', 2, 3.4]);   //=> 'a 2 3.4'
  8533.      *      R.join('|', [1, 2, 3]);    //=> '1|2|3'
  8534.      */
  8535.     var join = invoker(1, 'join');
  8536.  
  8537.     /**
  8538.      * Creates a new function that, when invoked, caches the result of calling `fn`
  8539.      * for a given argument set and returns the result. Subsequent calls to the
  8540.      * memoized `fn` with the same argument set will not result in an additional
  8541.      * call to `fn`; instead, the cached result for that set of arguments will be
  8542.      * returned.
  8543.      *
  8544.      * @func
  8545.      * @memberOf R
  8546.      * @since v0.1.0
  8547.      * @category Function
  8548.      * @sig (*... -> a) -> (*... -> a)
  8549.      * @param {Function} fn The function to memoize.
  8550.      * @return {Function} Memoized version of `fn`.
  8551.      * @example
  8552.      *
  8553.      *      var count = 0;
  8554.      *      var factorial = R.memoize(n => {
  8555.      *        count += 1;
  8556.      *        return R.product(R.range(1, n + 1));
  8557.      *      });
  8558.      *      factorial(5); //=> 120
  8559.      *      factorial(5); //=> 120
  8560.      *      factorial(5); //=> 120
  8561.      *      count; //=> 1
  8562.      */
  8563.     var memoize = _curry1(function memoize(fn) {
  8564.         var cache = {};
  8565.         return _arity(fn.length, function () {
  8566.             var key = toString(arguments);
  8567.             if (!_has(key, cache)) {
  8568.                 cache[key] = fn.apply(this, arguments);
  8569.             }
  8570.             return cache[key];
  8571.         });
  8572.     });
  8573.  
  8574.     /**
  8575.      * Splits a string into an array of strings based on the given
  8576.      * separator.
  8577.      *
  8578.      * @func
  8579.      * @memberOf R
  8580.      * @since v0.1.0
  8581.      * @category String
  8582.      * @sig (String | RegExp) -> String -> [String]
  8583.      * @param {String|RegExp} sep The pattern.
  8584.      * @param {String} str The string to separate into an array.
  8585.      * @return {Array} The array of strings from `str` separated by `str`.
  8586.      * @see R.join
  8587.      * @example
  8588.      *
  8589.      *      var pathComponents = R.split('/');
  8590.      *      R.tail(pathComponents('/usr/local/bin/node')); //=> ['usr', 'local', 'bin', 'node']
  8591.      *
  8592.      *      R.split('.', 'a.b.c.xyz.d'); //=> ['a', 'b', 'c', 'xyz', 'd']
  8593.      */
  8594.     var split = invoker(1, 'split');
  8595.  
  8596.     /**
  8597.      * Finds the set (i.e. no duplicates) of all elements contained in the first or
  8598.      * second list, but not both.
  8599.      *
  8600.      * @func
  8601.      * @memberOf R
  8602.      * @since v0.19.0
  8603.      * @category Relation
  8604.      * @sig [*] -> [*] -> [*]
  8605.      * @param {Array} list1 The first list.
  8606.      * @param {Array} list2 The second list.
  8607.      * @return {Array} The elements in `list1` or `list2`, but not both.
  8608.      * @see R.symmetricDifferenceWith, R.difference, R.differenceWith
  8609.      * @example
  8610.      *
  8611.      *      R.symmetricDifference([1,2,3,4], [7,6,5,4,3]); //=> [1,2,7,6,5]
  8612.      *      R.symmetricDifference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5,1,2]
  8613.      */
  8614.     var symmetricDifference = _curry2(function symmetricDifference(list1, list2) {
  8615.         return concat(difference(list1, list2), difference(list2, list1));
  8616.     });
  8617.  
  8618.     /**
  8619.      * Finds the set (i.e. no duplicates) of all elements contained in the first or
  8620.      * second list, but not both. Duplication is determined according to the value
  8621.      * returned by applying the supplied predicate to two list elements.
  8622.      *
  8623.      * @func
  8624.      * @memberOf R
  8625.      * @since v0.19.0
  8626.      * @category Relation
  8627.      * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a]
  8628.      * @param {Function} pred A predicate used to test whether two items are equal.
  8629.      * @param {Array} list1 The first list.
  8630.      * @param {Array} list2 The second list.
  8631.      * @return {Array} The elements in `list1` or `list2`, but not both.
  8632.      * @see R.symmetricDifference, R.difference, R.differenceWith
  8633.      * @example
  8634.      *
  8635.      *      var eqA = R.eqBy(R.prop('a'));
  8636.      *      var l1 = [{a: 1}, {a: 2}, {a: 3}, {a: 4}];
  8637.      *      var l2 = [{a: 3}, {a: 4}, {a: 5}, {a: 6}];
  8638.      *      R.symmetricDifferenceWith(eqA, l1, l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}]
  8639.      */
  8640.     var symmetricDifferenceWith = _curry3(function symmetricDifferenceWith(pred, list1, list2) {
  8641.         return concat(differenceWith(pred, list1, list2), differenceWith(pred, list2, list1));
  8642.     });
  8643.  
  8644.     /**
  8645.      * Determines whether a given string matches a given regular expression.
  8646.      *
  8647.      * @func
  8648.      * @memberOf R
  8649.      * @since v0.12.0
  8650.      * @category String
  8651.      * @sig RegExp -> String -> Boolean
  8652.      * @param {RegExp} pattern
  8653.      * @param {String} str
  8654.      * @return {Boolean}
  8655.      * @see R.match
  8656.      * @example
  8657.      *
  8658.      *      R.test(/^x/, 'xyz'); //=> true
  8659.      *      R.test(/^y/, 'xyz'); //=> false
  8660.      */
  8661.     var test = _curry2(function test(pattern, str) {
  8662.         if (!_isRegExp(pattern)) {
  8663.             throw new TypeError('\u2018test\u2019 requires a value of type RegExp as its first argument; received ' + toString(pattern));
  8664.         }
  8665.         return _cloneRegExp(pattern).test(str);
  8666.     });
  8667.  
  8668.     /**
  8669.      * The lower case version of a string.
  8670.      *
  8671.      * @func
  8672.      * @memberOf R
  8673.      * @since v0.9.0
  8674.      * @category String
  8675.      * @sig String -> String
  8676.      * @param {String} str The string to lower case.
  8677.      * @return {String} The lower case version of `str`.
  8678.      * @see R.toUpper
  8679.      * @example
  8680.      *
  8681.      *      R.toLower('XYZ'); //=> 'xyz'
  8682.      */
  8683.     var toLower = invoker(0, 'toLowerCase');
  8684.  
  8685.     /**
  8686.      * The upper case version of a string.
  8687.      *
  8688.      * @func
  8689.      * @memberOf R
  8690.      * @since v0.9.0
  8691.      * @category String
  8692.      * @sig String -> String
  8693.      * @param {String} str The string to upper case.
  8694.      * @return {String} The upper case version of `str`.
  8695.      * @see R.toLower
  8696.      * @example
  8697.      *
  8698.      *      R.toUpper('abc'); //=> 'ABC'
  8699.      */
  8700.     var toUpper = invoker(0, 'toUpperCase');
  8701.  
  8702.     /**
  8703.      * Returns a new list containing only one copy of each element in the original
  8704.      * list, based upon the value returned by applying the supplied function to
  8705.      * each list element. Prefers the first item if the supplied function produces
  8706.      * the same value on two items. `R.equals` is used for comparison.
  8707.      *
  8708.      * @func
  8709.      * @memberOf R
  8710.      * @since v0.16.0
  8711.      * @category List
  8712.      * @sig (a -> b) -> [a] -> [a]
  8713.      * @param {Function} fn A function used to produce a value to use during comparisons.
  8714.      * @param {Array} list The array to consider.
  8715.      * @return {Array} The list of unique items.
  8716.      * @example
  8717.      *
  8718.      *      R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10]
  8719.      */
  8720.     var uniqBy = _curry2(function uniqBy(fn, list) {
  8721.         var set = new _Set();
  8722.         var result = [];
  8723.         var idx = 0;
  8724.         var appliedItem, item;
  8725.         while (idx < list.length) {
  8726.             item = list[idx];
  8727.             appliedItem = fn(item);
  8728.             if (set.add(appliedItem)) {
  8729.                 result.push(item);
  8730.             }
  8731.             idx += 1;
  8732.         }
  8733.         return result;
  8734.     });
  8735.  
  8736.     /**
  8737.      * Returns a new list containing only one copy of each element in the original
  8738.      * list. `R.equals` is used to determine equality.
  8739.      *
  8740.      * @func
  8741.      * @memberOf R
  8742.      * @since v0.1.0
  8743.      * @category List
  8744.      * @sig [a] -> [a]
  8745.      * @param {Array} list The array to consider.
  8746.      * @return {Array} The list of unique items.
  8747.      * @example
  8748.      *
  8749.      *      R.uniq([1, 1, 2, 1]); //=> [1, 2]
  8750.      *      R.uniq([1, '1']);     //=> [1, '1']
  8751.      *      R.uniq([[42], [42]]); //=> [[42]]
  8752.      */
  8753.     var uniq = uniqBy(identity);
  8754.  
  8755.     /**
  8756.      * Combines two lists into a set (i.e. no duplicates) composed of those
  8757.      * elements common to both lists.
  8758.      *
  8759.      * @func
  8760.      * @memberOf R
  8761.      * @since v0.1.0
  8762.      * @category Relation
  8763.      * @sig [*] -> [*] -> [*]
  8764.      * @param {Array} list1 The first list.
  8765.      * @param {Array} list2 The second list.
  8766.      * @return {Array} The list of elements found in both `list1` and `list2`.
  8767.      * @see R.intersectionWith
  8768.      * @example
  8769.      *
  8770.      *      R.intersection([1,2,3,4], [7,6,5,4,3]); //=> [4, 3]
  8771.      */
  8772.     var intersection = _curry2(function intersection(list1, list2) {
  8773.         var lookupList, filteredList;
  8774.         if (list1.length > list2.length) {
  8775.             lookupList = list1;
  8776.             filteredList = list2;
  8777.         } else {
  8778.             lookupList = list2;
  8779.             filteredList = list1;
  8780.         }
  8781.         return uniq(_filter(flip(_contains)(lookupList), filteredList));
  8782.     });
  8783.  
  8784.     /**
  8785.      * Combines two lists into a set (i.e. no duplicates) composed of the elements
  8786.      * of each list.
  8787.      *
  8788.      * @func
  8789.      * @memberOf R
  8790.      * @since v0.1.0
  8791.      * @category Relation
  8792.      * @sig [*] -> [*] -> [*]
  8793.      * @param {Array} as The first list.
  8794.      * @param {Array} bs The second list.
  8795.      * @return {Array} The first and second lists concatenated, with
  8796.      *         duplicates removed.
  8797.      * @example
  8798.      *
  8799.      *      R.union([1, 2, 3], [2, 3, 4]); //=> [1, 2, 3, 4]
  8800.      */
  8801.     var union = _curry2(compose(uniq, _concat));
  8802.  
  8803.     var R = {
  8804.         F: F,
  8805.         T: T,
  8806.         __: __,
  8807.         add: add,
  8808.         addIndex: addIndex,
  8809.         adjust: adjust,
  8810.         all: all,
  8811.         allPass: allPass,
  8812.         always: always,
  8813.         and: and,
  8814.         any: any,
  8815.         anyPass: anyPass,
  8816.         ap: ap,
  8817.         aperture: aperture,
  8818.         append: append,
  8819.         apply: apply,
  8820.         applySpec: applySpec,
  8821.         ascend: ascend,
  8822.         assoc: assoc,
  8823.         assocPath: assocPath,
  8824.         binary: binary,
  8825.         bind: bind,
  8826.         both: both,
  8827.         call: call,
  8828.         chain: chain,
  8829.         clamp: clamp,
  8830.         clone: clone,
  8831.         comparator: comparator,
  8832.         complement: complement,
  8833.         compose: compose,
  8834.         composeK: composeK,
  8835.         composeP: composeP,
  8836.         concat: concat,
  8837.         cond: cond,
  8838.         construct: construct,
  8839.         constructN: constructN,
  8840.         contains: contains,
  8841.         converge: converge,
  8842.         countBy: countBy,
  8843.         curry: curry,
  8844.         curryN: curryN,
  8845.         dec: dec,
  8846.         defaultTo: defaultTo,
  8847.         descend: descend,
  8848.         difference: difference,
  8849.         differenceWith: differenceWith,
  8850.         dissoc: dissoc,
  8851.         dissocPath: dissocPath,
  8852.         divide: divide,
  8853.         drop: drop,
  8854.         dropLast: dropLast,
  8855.         dropLastWhile: dropLastWhile,
  8856.         dropRepeats: dropRepeats,
  8857.         dropRepeatsWith: dropRepeatsWith,
  8858.         dropWhile: dropWhile,
  8859.         either: either,
  8860.         empty: empty,
  8861.         eqBy: eqBy,
  8862.         eqProps: eqProps,
  8863.         equals: equals,
  8864.         evolve: evolve,
  8865.         filter: filter,
  8866.         find: find,
  8867.         findIndex: findIndex,
  8868.         findLast: findLast,
  8869.         findLastIndex: findLastIndex,
  8870.         flatten: flatten,
  8871.         flip: flip,
  8872.         forEach: forEach,
  8873.         forEachObjIndexed: forEachObjIndexed,
  8874.         fromPairs: fromPairs,
  8875.         groupBy: groupBy,
  8876.         groupWith: groupWith,
  8877.         gt: gt,
  8878.         gte: gte,
  8879.         has: has,
  8880.         hasIn: hasIn,
  8881.         head: head,
  8882.         identical: identical,
  8883.         identity: identity,
  8884.         ifElse: ifElse,
  8885.         inc: inc,
  8886.         indexBy: indexBy,
  8887.         indexOf: indexOf,
  8888.         init: init,
  8889.         insert: insert,
  8890.         insertAll: insertAll,
  8891.         intersection: intersection,
  8892.         intersectionWith: intersectionWith,
  8893.         intersperse: intersperse,
  8894.         into: into,
  8895.         invert: invert,
  8896.         invertObj: invertObj,
  8897.         invoker: invoker,
  8898.         is: is,
  8899.         isArrayLike: isArrayLike,
  8900.         isEmpty: isEmpty,
  8901.         isNil: isNil,
  8902.         join: join,
  8903.         juxt: juxt,
  8904.         keys: keys,
  8905.         keysIn: keysIn,
  8906.         last: last,
  8907.         lastIndexOf: lastIndexOf,
  8908.         length: length,
  8909.         lens: lens,
  8910.         lensIndex: lensIndex,
  8911.         lensPath: lensPath,
  8912.         lensProp: lensProp,
  8913.         lift: lift,
  8914.         liftN: liftN,
  8915.         lt: lt,
  8916.         lte: lte,
  8917.         map: map,
  8918.         mapAccum: mapAccum,
  8919.         mapAccumRight: mapAccumRight,
  8920.         mapObjIndexed: mapObjIndexed,
  8921.         match: match,
  8922.         mathMod: mathMod,
  8923.         max: max,
  8924.         maxBy: maxBy,
  8925.         mean: mean,
  8926.         median: median,
  8927.         memoize: memoize,
  8928.         merge: merge,
  8929.         mergeAll: mergeAll,
  8930.         mergeWith: mergeWith,
  8931.         mergeWithKey: mergeWithKey,
  8932.         min: min,
  8933.         minBy: minBy,
  8934.         modulo: modulo,
  8935.         multiply: multiply,
  8936.         nAry: nAry,
  8937.         negate: negate,
  8938.         none: none,
  8939.         not: not,
  8940.         nth: nth,
  8941.         nthArg: nthArg,
  8942.         objOf: objOf,
  8943.         of: of,
  8944.         omit: omit,
  8945.         once: once,
  8946.         or: or,
  8947.         over: over,
  8948.         pair: pair,
  8949.         partial: partial,
  8950.         partialRight: partialRight,
  8951.         partition: partition,
  8952.         path: path,
  8953.         pathEq: pathEq,
  8954.         pathOr: pathOr,
  8955.         pathSatisfies: pathSatisfies,
  8956.         pick: pick,
  8957.         pickAll: pickAll,
  8958.         pickBy: pickBy,
  8959.         pipe: pipe,
  8960.         pipeK: pipeK,
  8961.         pipeP: pipeP,
  8962.         pluck: pluck,
  8963.         prepend: prepend,
  8964.         product: product,
  8965.         project: project,
  8966.         prop: prop,
  8967.         propEq: propEq,
  8968.         propIs: propIs,
  8969.         propOr: propOr,
  8970.         propSatisfies: propSatisfies,
  8971.         props: props,
  8972.         range: range,
  8973.         reduce: reduce,
  8974.         reduceBy: reduceBy,
  8975.         reduceRight: reduceRight,
  8976.         reduceWhile: reduceWhile,
  8977.         reduced: reduced,
  8978.         reject: reject,
  8979.         remove: remove,
  8980.         repeat: repeat,
  8981.         replace: replace,
  8982.         reverse: reverse,
  8983.         scan: scan,
  8984.         sequence: sequence,
  8985.         set: set,
  8986.         slice: slice,
  8987.         sort: sort,
  8988.         sortBy: sortBy,
  8989.         sortWith: sortWith,
  8990.         split: split,
  8991.         splitAt: splitAt,
  8992.         splitEvery: splitEvery,
  8993.         splitWhen: splitWhen,
  8994.         subtract: subtract,
  8995.         sum: sum,
  8996.         symmetricDifference: symmetricDifference,
  8997.         symmetricDifferenceWith: symmetricDifferenceWith,
  8998.         tail: tail,
  8999.         take: take,
  9000.         takeLast: takeLast,
  9001.         takeLastWhile: takeLastWhile,
  9002.         takeWhile: takeWhile,
  9003.         tap: tap,
  9004.         test: test,
  9005.         times: times,
  9006.         toLower: toLower,
  9007.         toPairs: toPairs,
  9008.         toPairsIn: toPairsIn,
  9009.         toString: toString,
  9010.         toUpper: toUpper,
  9011.         transduce: transduce,
  9012.         transpose: transpose,
  9013.         traverse: traverse,
  9014.         trim: trim,
  9015.         tryCatch: tryCatch,
  9016.         type: type,
  9017.         unapply: unapply,
  9018.         unary: unary,
  9019.         uncurryN: uncurryN,
  9020.         unfold: unfold,
  9021.         union: union,
  9022.         unionWith: unionWith,
  9023.         uniq: uniq,
  9024.         uniqBy: uniqBy,
  9025.         uniqWith: uniqWith,
  9026.         unless: unless,
  9027.         unnest: unnest,
  9028.         until: until,
  9029.         update: update,
  9030.         useWith: useWith,
  9031.         values: values,
  9032.         valuesIn: valuesIn,
  9033.         view: view,
  9034.         when: when,
  9035.         where: where,
  9036.         whereEq: whereEq,
  9037.         without: without,
  9038.         xprod: xprod,
  9039.         zip: zip,
  9040.         zipObj: zipObj,
  9041.         zipWith: zipWith
  9042.     };
  9043.   /* eslint-env amd */
  9044.  
  9045.     return R
  9046.  
  9047. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement