/// <summary> /// Transposes the rows and columns of a 2D list.When passed a list of `n` lists of length `x`,returns a list of `x` lists of length `n`. /// <para /> /// sig: [[a]] -> [[a]] /// </summary> /// <param name="list">A 2D list</param> /// <returns>A 2D list</returns> public static dynamic Transpose <TArg>(TArg[][] list) { return(Currying.Transpose(list)); }
/// <summary> /// Splits a given list or string at a given index. /// <para /> /// sig: Number -> [a] -> [[a], [a]] /// </summary> /// <param name="index">The index where the array/string is split.</param> /// <param name="array">The array/string to be split.</param> /// <returns>Array</returns> public static dynamic SplitAt <TSource>(int index, IList <TSource> array) { return(Currying.SplitAt(index, array)); }
/// <summary> /// Splits a given list or string at a given index. /// <para /> /// sig: Number -> [a] -> [[a], [a]] /// </summary> /// <param name="index">The index where the array/string is split.</param> /// <param name="array">The array/string to be split.</param> /// <returns>Array</returns> public static dynamic SplitAt(RamdaPlaceholder index = null, RamdaPlaceholder array = null) { return(Currying.SplitAt(index, array)); }
/// <summary> /// Groups the elements of the list according to the result of callingthe String-returning function `keyFn` on each element and reduces the elementsof each group to a single value via the reducer function `valueFn`.This function is basically a more general `groupBy` function.Acts as a transducer if a transformer is given in list position. /// <para /> /// sig: ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a} /// </summary> /// <param name="valueFn">The function that reduces the elements of each group to a single value. Receives two values, accumulator for a particular group and the current element.</param> /// <param name="acc">The (initial) accumulator value for each group.</param> /// <param name="keyFn">The function that maps the list's element into a key.</param> /// <param name="list">The array to group.</param> /// <returns>An object with the output of `keyFn` for keys, mapped to the output of `valueFn` for elements which produced that key when passed to `keyFn`.</returns> /// <see cref="R.GroupBy"/> /// <see cref="R.Reduce"/> public static dynamic ReduceBy(RamdaPlaceholder fn = null, RamdaPlaceholder acc = null, RamdaPlaceholder keyFn = null, RamdaPlaceholder list = null) { return(Currying.ReduceBy(fn, acc, keyFn, list)); }
/// <summary> /// Groups the elements of the list according to the result of callingthe String-returning function `keyFn` on each element and reduces the elementsof each group to a single value via the reducer function `valueFn`.This function is basically a more general `groupBy` function.Acts as a transducer if a transformer is given in list position. /// <para /> /// sig: ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a} /// </summary> /// <param name="valueFn">The function that reduces the elements of each group to a single value. Receives two values, accumulator for a particular group and the current element.</param> /// <param name="acc">The (initial) accumulator value for each group.</param> /// <param name="keyFn">The function that maps the list's element into a key.</param> /// <param name="list">The array to group.</param> /// <returns>An object with the output of `keyFn` for keys, mapped to the output of `valueFn` for elements which produced that key when passed to `keyFn`.</returns> /// <see cref="R.GroupBy"/> /// <see cref="R.Reduce"/> public static dynamic ReduceBy <TSource, TAccmulator, TReturn>(Func <TAccmulator, TSource, TReturn> fn, TAccmulator acc, RamdaPlaceholder keyFn, IList <TSource> list) { return(Currying.ReduceBy(Delegate(fn), acc, keyFn, list)); }
/// <summary> /// Groups the elements of the list according to the result of callingthe String-returning function `keyFn` on each element and reduces the elementsof each group to a single value via the reducer function `valueFn`.This function is basically a more general `groupBy` function.Acts as a transducer if a transformer is given in list position. /// <para /> /// sig: ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a} /// </summary> /// <param name="valueFn">The function that reduces the elements of each group to a single value. Receives two values, accumulator for a particular group and the current element.</param> /// <param name="acc">The (initial) accumulator value for each group.</param> /// <param name="keyFn">The function that maps the list's element into a key.</param> /// <param name="list">The array to group.</param> /// <returns>An object with the output of `keyFn` for keys, mapped to the output of `valueFn` for elements which produced that key when passed to `keyFn`.</returns> /// <see cref="R.GroupBy"/> /// <see cref="R.Reduce"/> public static dynamic ReduceBy <TSource>(dynamic fn, RamdaPlaceholder acc, dynamic keyFn, IList <TSource> list) { return(Currying.ReduceBy(Delegate(fn), acc, Delegate(keyFn), list)); }
/// <summary> /// Groups the elements of the list according to the result of callingthe String-returning function `keyFn` on each element and reduces the elementsof each group to a single value via the reducer function `valueFn`.This function is basically a more general `groupBy` function.Acts as a transducer if a transformer is given in list position. /// <para /> /// sig: ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a} /// </summary> /// <param name="valueFn">The function that reduces the elements of each group to a single value. Receives two values, accumulator for a particular group and the current element.</param> /// <param name="acc">The (initial) accumulator value for each group.</param> /// <param name="keyFn">The function that maps the list's element into a key.</param> /// <param name="list">The array to group.</param> /// <returns>An object with the output of `keyFn` for keys, mapped to the output of `valueFn` for elements which produced that key when passed to `keyFn`.</returns> /// <see cref="R.GroupBy"/> /// <see cref="R.Reduce"/> public static dynamic ReduceBy <TSource, TAccmulator>(dynamic fn, TAccmulator acc, dynamic keyFn, IList <TSource> list) { return(Currying.ReduceBy(Delegate(fn), acc, Delegate(keyFn), list)); }
/// <summary> /// Replace a substring or regex match in a string with a replacement. /// <para /> /// sig: RegExp|String -> String -> String -> String /// </summary> /// <param name="pattern">A regular expression or a substring to match.</param> /// <param name="replacement">The string to replace the matches with.</param> /// <param name="str">The String to do the search and replacement in.</param> /// <returns>The result.</returns> public static dynamic Replace(string pattern, RamdaPlaceholder replacement = null, RamdaPlaceholder str = null) { return(Currying.Replace(pattern, replacement, str)); }
/// <summary> /// Splits a list into sub-lists stored in an object, based on the result ofcalling a String-returning function on each element, and grouping theresults according to values returned.Dispatches to the `groupBy` method of the second argument, if present.Acts as a transducer if a transformer is given in list position. /// <para /> /// sig: (a -> String) -> [a] -> {String: [a]} /// </summary> /// <param name="fn">Function :: a -<![CDATA[>]]> String</param> /// <param name="list">The array to group</param> /// <returns>An object with the output of `fn` for keys, mapped to arrays of elements that produced that key when passed to `fn`.</returns> /// <see cref="R.Transduce"/> public static dynamic GroupBy <TSource>(Func <TSource, string> fn, ITransformer list) { return(Currying.GroupBy(Delegate(fn), list)); }
/// <summary> /// Accepts a function `fn` and returns a function that guards invocation of`fn` such that `fn` can only ever be called once, no matter how many timesthe returned function is invoked. The first value calculated is returned insubsequent invocations. /// <para /> /// sig: (a... -> b) -> (a... -> b) /// </summary> /// <param name="fn">The function to wrap in a call-only-once wrapper.</param> /// <returns>The wrapped function.</returns> public static dynamic Once(dynamic fn) { return(Currying.Once(Delegate(fn))); }
/// <summary> /// Replace a substring or regex match in a string with a replacement. /// <para /> /// sig: RegExp|String -> String -> String -> String /// </summary> /// <param name="pattern">A regular expression or a substring to match.</param> /// <param name="replacement">The string to replace the matches with.</param> /// <param name="str">The String to do the search and replacement in.</param> /// <returns>The result.</returns> public static dynamic Replace(string pattern, string replacement, string str) { return(Currying.Replace(pattern, replacement, str)); }
/// <summary> /// Accepts a function `fn` and returns a function that guards invocation of`fn` such that `fn` can only ever be called once, no matter how many timesthe returned function is invoked. The first value calculated is returned insubsequent invocations. /// <para /> /// sig: (a... -> b) -> (a... -> b) /// </summary> /// <param name="fn">The function to wrap in a call-only-once wrapper.</param> /// <returns>The wrapped function.</returns> public static dynamic Once(RamdaPlaceholder fn = null) { return(Currying.Once(fn)); }
/// <summary> /// Returns a new list by pulling every item out of it (and all its sub-arrays)and putting them in a new array, depth-first. /// <para /> /// sig: [a] -> [b] /// </summary> /// <param name="list">The array to consider.</param> /// <returns>The flattened list.</returns> /// <see cref="R.Unnest"/> public static dynamic Flatten(ExpandoObject list) { return(Currying.Flatten(list)); }
/// <summary> /// Transposes the rows and columns of a 2D list.When passed a list of `n` lists of length `x`,returns a list of `x` lists of length `n`. /// <para /> /// sig: [[a]] -> [[a]] /// </summary> /// <param name="list">A 2D list</param> /// <returns>A 2D list</returns> public static dynamic Transpose(RamdaPlaceholder list = null) { return(Currying.Transpose(list)); }
/// <summary> /// Finds the set (i.e. no duplicates) of all elements in the first list notcontained in the second list. Duplication is determined according to thevalue returned by applying the supplied predicate to two list elements. /// <para /> /// sig: ((a, a) -> Boolean) -> [a] -> [a] -> [a] /// </summary> /// <param name="pred">A predicate used to test whether two items are equal.</param> /// <param name="list1">The first list.</param> /// <param name="list2">The second list.</param> /// <returns>The elements in `list1` that are not in `list2`.</returns> /// <see cref="R.Difference"/> /// <see cref="R.SymmetricDifference"/> /// <see cref="R.SymmetricDifferenceWith"/> public static dynamic DifferenceWith <TSource>(Func <TSource, TSource, bool> pred, RamdaPlaceholder list1 = null, RamdaPlaceholder list2 = null) { return(Currying.DifferenceWith(Delegate(pred), list1, list2)); }
/// <summary> /// Splits a list into sub-lists stored in an object, based on the result ofcalling a String-returning function on each element, and grouping theresults according to values returned.Dispatches to the `groupBy` method of the second argument, if present.Acts as a transducer if a transformer is given in list position. /// <para /> /// sig: (a -> String) -> [a] -> {String: [a]} /// </summary> /// <param name="fn">Function :: a -<![CDATA[>]]> String</param> /// <param name="list">The array to group</param> /// <returns>An object with the output of `fn` for keys, mapped to arrays of elements that produced that key when passed to `fn`.</returns> /// <see cref="R.Transduce"/> public static dynamic GroupBy(RamdaPlaceholder fn, ITransformer list) { return(Currying.GroupBy(fn, list)); }
/// <summary> /// Wraps a constructor function inside a curried function that can be calledwith the same arguments and returns the same type. /// <para /> /// sig: (* -> {*}) -> (* -> {*}) /// </summary> /// <param name="fn">The constructor function to wrap.</param> /// <returns>A wrapped, curried constructor function.</returns> public static dynamic Construct <TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TTarget>(Func <TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TTarget> fn) { return(Currying.Construct(fn)); }
/// <summary> /// Splits a list into sub-lists stored in an object, based on the result ofcalling a String-returning function on each element, and grouping theresults according to values returned.Dispatches to the `groupBy` method of the second argument, if present.Acts as a transducer if a transformer is given in list position. /// <para /> /// sig: (a -> String) -> [a] -> {String: [a]} /// </summary> /// <param name="fn">Function :: a -<![CDATA[>]]> String</param> /// <param name="list">The array to group</param> /// <returns>An object with the output of `fn` for keys, mapped to arrays of elements that produced that key when passed to `fn`.</returns> /// <see cref="R.Transduce"/> public static dynamic GroupBy(dynamic fn, ITransformer list) { return(Currying.GroupBy(Delegate(fn), list)); }
/// <summary> /// Groups the elements of the list according to the result of callingthe String-returning function `keyFn` on each element and reduces the elementsof each group to a single value via the reducer function `valueFn`.This function is basically a more general `groupBy` function.Acts as a transducer if a transformer is given in list position. /// <para /> /// sig: ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a} /// </summary> /// <param name="valueFn">The function that reduces the elements of each group to a single value. Receives two values, accumulator for a particular group and the current element.</param> /// <param name="acc">The (initial) accumulator value for each group.</param> /// <param name="keyFn">The function that maps the list's element into a key.</param> /// <param name="list">The array to group.</param> /// <returns>An object with the output of `keyFn` for keys, mapped to the output of `valueFn` for elements which produced that key when passed to `keyFn`.</returns> /// <see cref="R.GroupBy"/> /// <see cref="R.Reduce"/> public static dynamic ReduceBy <TAccmulator>(dynamic fn, TAccmulator acc, RamdaPlaceholder keyFn = null, RamdaPlaceholder list = null) { return(Currying.ReduceBy(Delegate(fn), acc, keyFn, list)); }
/// <summary> /// Finds the set (i.e. no duplicates) of all elements in the first list notcontained in the second list. Duplication is determined according to thevalue returned by applying the supplied predicate to two list elements. /// <para /> /// sig: ((a, a) -> Boolean) -> [a] -> [a] -> [a] /// </summary> /// <param name="pred">A predicate used to test whether two items are equal.</param> /// <param name="list1">The first list.</param> /// <param name="list2">The second list.</param> /// <returns>The elements in `list1` that are not in `list2`.</returns> /// <see cref="R.Difference"/> /// <see cref="R.SymmetricDifference"/> /// <see cref="R.SymmetricDifferenceWith"/> public static dynamic DifferenceWith <TSource>(dynamic pred, RamdaPlaceholder list1, IList <TSource> list2) { return(Currying.DifferenceWith(Delegate(pred), list1, list2)); }
/// <summary> /// Groups the elements of the list according to the result of callingthe String-returning function `keyFn` on each element and reduces the elementsof each group to a single value via the reducer function `valueFn`.This function is basically a more general `groupBy` function.Acts as a transducer if a transformer is given in list position. /// <para /> /// sig: ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a} /// </summary> /// <param name="valueFn">The function that reduces the elements of each group to a single value. Receives two values, accumulator for a particular group and the current element.</param> /// <param name="acc">The (initial) accumulator value for each group.</param> /// <param name="keyFn">The function that maps the list's element into a key.</param> /// <param name="list">The array to group.</param> /// <returns>An object with the output of `keyFn` for keys, mapped to the output of `valueFn` for elements which produced that key when passed to `keyFn`.</returns> /// <see cref="R.GroupBy"/> /// <see cref="R.Reduce"/> public static dynamic ReduceBy <TSource, TAccmulator, TReturn>(Func <TAccmulator, TSource, TReturn> fn, TAccmulator acc, Func <TSource, string> keyFn, IList <TSource> list) { return(Currying.ReduceBy(Delegate(fn), acc, Delegate(keyFn), list)); }
/// <summary> /// Finds the set (i.e. no duplicates) of all elements in the first list notcontained in the second list. Duplication is determined according to thevalue returned by applying the supplied predicate to two list elements. /// <para /> /// sig: ((a, a) -> Boolean) -> [a] -> [a] -> [a] /// </summary> /// <param name="pred">A predicate used to test whether two items are equal.</param> /// <param name="list1">The first list.</param> /// <param name="list2">The second list.</param> /// <returns>The elements in `list1` that are not in `list2`.</returns> /// <see cref="R.Difference"/> /// <see cref="R.SymmetricDifference"/> /// <see cref="R.SymmetricDifferenceWith"/> public static dynamic DifferenceWith(dynamic pred, RamdaPlaceholder list1 = null, RamdaPlaceholder list2 = null) { return(Currying.DifferenceWith(Delegate(pred), list1, list2)); }
/// <summary> /// Groups the elements of the list according to the result of callingthe String-returning function `keyFn` on each element and reduces the elementsof each group to a single value via the reducer function `valueFn`.This function is basically a more general `groupBy` function.Acts as a transducer if a transformer is given in list position. /// <para /> /// sig: ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a} /// </summary> /// <param name="valueFn">The function that reduces the elements of each group to a single value. Receives two values, accumulator for a particular group and the current element.</param> /// <param name="acc">The (initial) accumulator value for each group.</param> /// <param name="keyFn">The function that maps the list's element into a key.</param> /// <param name="list">The array to group.</param> /// <returns>An object with the output of `keyFn` for keys, mapped to the output of `valueFn` for elements which produced that key when passed to `keyFn`.</returns> /// <see cref="R.GroupBy"/> /// <see cref="R.Reduce"/> public static dynamic ReduceBy <TSource, TAccmulator>(RamdaPlaceholder fn, TAccmulator acc, Func <TSource, string> keyFn, IList <TSource> list) { return(Currying.ReduceBy(fn, acc, Delegate(keyFn), list)); }
/// <summary> /// Finds the set (i.e. no duplicates) of all elements in the first list notcontained in the second list. Duplication is determined according to thevalue returned by applying the supplied predicate to two list elements. /// <para /> /// sig: ((a, a) -> Boolean) -> [a] -> [a] -> [a] /// </summary> /// <param name="pred">A predicate used to test whether two items are equal.</param> /// <param name="list1">The first list.</param> /// <param name="list2">The second list.</param> /// <returns>The elements in `list1` that are not in `list2`.</returns> /// <see cref="R.Difference"/> /// <see cref="R.SymmetricDifference"/> /// <see cref="R.SymmetricDifferenceWith"/> public static dynamic DifferenceWith(RamdaPlaceholder pred = null, RamdaPlaceholder list1 = null, RamdaPlaceholder list2 = null) { return(Currying.DifferenceWith(pred, list1, list2)); }
/// <summary> /// Groups the elements of the list according to the result of callingthe String-returning function `keyFn` on each element and reduces the elementsof each group to a single value via the reducer function `valueFn`.This function is basically a more general `groupBy` function.Acts as a transducer if a transformer is given in list position. /// <para /> /// sig: ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a} /// </summary> /// <param name="valueFn">The function that reduces the elements of each group to a single value. Receives two values, accumulator for a particular group and the current element.</param> /// <param name="acc">The (initial) accumulator value for each group.</param> /// <param name="keyFn">The function that maps the list's element into a key.</param> /// <param name="list">The array to group.</param> /// <returns>An object with the output of `keyFn` for keys, mapped to the output of `valueFn` for elements which produced that key when passed to `keyFn`.</returns> /// <see cref="R.GroupBy"/> /// <see cref="R.Reduce"/> public static dynamic ReduceBy <TSource, TAccmulator, TReturn>(Func <TAccmulator, TSource, TReturn> fn, TAccmulator acc, Func <TSource, string> keyFn, RamdaPlaceholder list = null) { return(Currying.ReduceBy(Delegate(fn), acc, Delegate(keyFn), list)); }
/// <summary> /// Finds the set (i.e. no duplicates) of all elements in the first list notcontained in the second list. Duplication is determined according to thevalue returned by applying the supplied predicate to two list elements. /// <para /> /// sig: ((a, a) -> Boolean) -> [a] -> [a] -> [a] /// </summary> /// <param name="pred">A predicate used to test whether two items are equal.</param> /// <param name="list1">The first list.</param> /// <param name="list2">The second list.</param> /// <returns>The elements in `list1` that are not in `list2`.</returns> /// <see cref="R.Difference"/> /// <see cref="R.SymmetricDifference"/> /// <see cref="R.SymmetricDifferenceWith"/> public static dynamic DifferenceWith <TSource>(Func <TSource, TSource, bool> pred, IList <TSource> list1, IList <TSource> list2) { return(Currying.DifferenceWith(Delegate(pred), list1, list2)); }
/// <summary> /// Splits a given list or string at a given index. /// <para /> /// sig: Number -> [a] -> [[a], [a]] /// </summary> /// <param name="index">The index where the array/string is split.</param> /// <param name="array">The array/string to be split.</param> /// <returns>Array</returns> public static dynamic SplitAt <TSource>(RamdaPlaceholder index, IList <TSource> array) { return(Currying.SplitAt(index, array)); }
/// <summary> /// Finds the set (i.e. no duplicates) of all elements in the first list notcontained in the second list. Duplication is determined according to thevalue returned by applying the supplied predicate to two list elements. /// <para /> /// sig: ((a, a) -> Boolean) -> [a] -> [a] -> [a] /// </summary> /// <param name="pred">A predicate used to test whether two items are equal.</param> /// <param name="list1">The first list.</param> /// <param name="list2">The second list.</param> /// <returns>The elements in `list1` that are not in `list2`.</returns> /// <see cref="R.Difference"/> /// <see cref="R.SymmetricDifference"/> /// <see cref="R.SymmetricDifferenceWith"/> public static dynamic DifferenceWith <TSource>(RamdaPlaceholder pred, IList <TSource> list1, IList <TSource> list2) { return(Currying.DifferenceWith(pred, list1, list2)); }
/// <summary> /// Transforms the items of the list with the transducer and appends thetransformed items to the accumulator using an appropriate iterator functionbased on the accumulator type.The accumulator can be an array, string, object or a transformer. Iterateditems will be appended to arrays and concatenated to strings. Objects willbe merged directly or 2-item arrays will be merged as key, value pairs.The accumulator can also be a transformer object that provides a 2-arityreducing iterator function, step, 0-arity initial value function, init, and1-arity result extraction function result. The step function is used as theiterator function in reduce. The result function is used to convert thefinal accumulator into the return type and in most cases is R.identity. Theinit function is used to provide the initial accumulator.The iteration is performed with R.reduce after initializing the transducer. /// <para /> /// sig: a -> (b -> b) -> [c] -> a /// </summary> /// <param name="acc">The initial accumulator value.</param> /// <param name="xf">The transducer function. Receives a transformer and returns a transformer.</param> /// <param name="list">The list to iterate over.</param> /// <returns>The final, accumulated value.</returns> public static dynamic Into <TAccumulator>(IList <TAccumulator> acc, dynamic xf, RamdaPlaceholder list = null) { return(Currying.Into(acc, Delegate(xf), list)); }
/// <summary> /// Takes a list of predicates and returns a predicate that returns true for agiven list of arguments if every one of the provided predicates is satisfiedby those arguments.The function returned is a curried function whose arity matches that of thehighest-arity predicate. /// <para /> /// sig: [(*... -> Boolean)] -> (*... -> Boolean) /// </summary> /// <param name="predicates">An array of predicates to check</param> /// <returns>The combined predicate</returns> /// <see cref="R.AnyPass"/> public static dynamic AllPass(RamdaPlaceholder preds = null) { return(Currying.AllPass(preds)); }