Comparing version 0.1.3 to 0.1.4
@@ -285,2 +285,9 @@ (function() { | ||
} | ||
l.isSubsequenceOf = function(xs, ys) { | ||
return l.nil(xs) ? true | ||
: l.nil(ys) ? false | ||
: l.head(xs).toString() == l.head(ys).toString() | ||
? l.isSubsequenceOf(l.tail(xs), l.tail(ys)) | ||
: l.isSubsequenceOf(xs, l.tail(ys)) | ||
} | ||
//Data.List searching by equality | ||
@@ -287,0 +294,0 @@ l.elem = function(x, xs) { |
{ | ||
"name": "lists", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "A library of higher-order functions modeled after Haskell's Data.List module", | ||
@@ -5,0 +5,0 @@ "main": "lists.js", |
522
README.md
@@ -25,3 +25,4 @@ # [ l [ i [ s ] t ] s ] | ||
* **f** : Function | ||
* **x** : variable | ||
* **x** : Variable | ||
* **boolean** : boolean | ||
@@ -44,8 +45,8 @@ A{ **1.** } Function number | ||
* [`append`](#append) : arr|str -> arr|str|num -> [x]|str | ||
* [`head`](#head) : arr|str -> x | ||
* [`last`](#last) : arr|str -> x | ||
* [`init`](#init) : arr|str -> [x] | ||
* [`tail`](#tail) : arr|str -> [x] | ||
* [`nil`](#nil) : arr|str -> boolean | ||
* [`append`](#append) : [x]|str -> [x]|str|num -> [x]|str | ||
* [`head`](#head) : [x]|str -> x | ||
* [`last`](#last) : [x]|str -> x | ||
* [`init`](#init) : [x]|str -> [x] | ||
* [`tail`](#tail) : [x]|str -> [x] | ||
* [`nil`](#nil) : [x]|str -> boolean | ||
@@ -58,3 +59,3 @@ ----- | ||
* [`rev`](#rev) : [x] -> [x] | ||
* [`intersperse`](#intersperse) : x -> [x] -> arr|str | ||
* [`intersperse`](#intersperse) : x -> [x] -> [x]|str | ||
* [`intercalate`](#intercalate) : [x] -> [[x]] -> [x] | ||
@@ -111,14 +112,22 @@ * [`transpose`](#transpose) : [[x]] -> [[x]] | ||
* [`stripPrefix`](#stripPrefix) : [num]|str -> [num]|str -> [num]|[str] | ||
* group : Eq a => [a] -> [[a]] | ||
* inits : [a] -> [[a]] | ||
* tails : [a] -> [[a]] | ||
* isPrefixOf : Eq a => [a] -> [a] -> Bool | ||
* isSuffixOf : Eq a => [a] -> [a] -> Bool | ||
* isInfixOf : Eq a => [a] -> [a] -> Bool | ||
* [`group`](#group) : [num]|str -> [[num]]|[[str]] | ||
* [`inits`](#inits) : [x] -> [[x]] | ||
* [`tails`](#tails) : [x] -> [[x]] | ||
----- | ||
**Predicates** | ||
* [`isPrefixOf`](#isPrefixOf) : [num]|str -> [num]|str -> boolean | ||
* [`isSuffixOf`](#isSuffixOf) : [num]|str -> [num]|str -> boolean | ||
* [`isInfixOf`](#isInfixOf) : [num]|str -> [num]|str -> boolean | ||
* [`isSubsequenceOf`](#isSubsequenceOf) : [num]|str -> [num]|str -> boolean | ||
----- | ||
**Searching Lists** | ||
* elem : Eq a => a -> [a] -> Bool | ||
* notElem : Eq a => a -> [a] -> Bool | ||
* lookup : Eq a => a -> [(a, b)] -> Maybe b | ||
* [`elem`](#elem) : num|str -> [num]|str -> boolean | ||
* [`notElem`](#notElem) : num|str -> [num]|str -> boolean | ||
* [`lookup`](#lookup) : num|str -> [[num|str,x]] -> boolean | ||
* find : (a -> Bool) -> [a] -> Maybe a | ||
@@ -128,2 +137,4 @@ * filter : (a -> Bool) -> [a] -> [a] | ||
----- | ||
**Indexing Lists** | ||
@@ -137,2 +148,4 @@ | ||
----- | ||
**Zipping and Unzipping Lists** | ||
@@ -143,2 +156,4 @@ | ||
----- | ||
**Special Lists** | ||
@@ -158,2 +173,4 @@ | ||
----- | ||
**Generalized Functions** | ||
@@ -172,2 +189,4 @@ | ||
----- | ||
**Extra Functional Utilities** | ||
@@ -190,7 +209,7 @@ | ||
<a name='append'/> | ||
### append : arr|str -> arr|str|num -> [x]|str | ||
### append : [x]|str -> [x]|str|num -> [x]|str | ||
------ | ||
**Description**: A prefix-style Array.prototype.concat wrapper. | ||
**Signature Definition**: Give arg 1 an Array or a String; Give arg 2 an Array or a String or a Number; Get an Array of variables or String. | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String. Give arg 2 an Array of Variables or a String or a Number. Get an Array of Variables or a String. | ||
@@ -206,7 +225,7 @@ **Example Usage**: | ||
<a name='head'/> | ||
### head : arr|str -> x | ||
### head : [x]|str -> x | ||
------ | ||
**Description**: Retreive the first element of an Array or a String. | ||
**Description**: Retreive the first element of an Array of Variables or a String. | ||
**Signature Definition**: Give arg 1 an Array or a String; Get a variable. | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String. Get a Variable. | ||
@@ -222,7 +241,7 @@ **Example Usage**: | ||
<a name='last'/> | ||
### last : arr|str -> x | ||
### last : [x]|str -> x | ||
------ | ||
**Description**: Retreive the last element of an Array or a String. | ||
**Description**: Retreive the last element of an Array of Variables or a String. | ||
**Signature Definition**: Give arg 1 an Array or a String; Get a variable. | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String. Get a Variable. | ||
@@ -238,7 +257,7 @@ **Example Usage**: | ||
<a name='init'/> | ||
### init : arr|str -> [x] | ||
### init : [x]|str -> [x] | ||
------ | ||
**Description**: Retreive all elements except the last of an Array or a String. | ||
**Description**: Retreive all elements except the last of an Array of Variables or a String. | ||
**Signature Definition**: Give arg 1 an Array or a String; Get an Array of variables. | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String. Get an Array of Variables. | ||
@@ -254,7 +273,7 @@ **Example Usage**: | ||
<a name='tail'/> | ||
### tail : arr|str -> [x] | ||
### tail : [x]|str -> [x] | ||
------ | ||
**Description**: Retreive all elements except the first of an Array or a String. | ||
**Description**: Retreive all elements except the first of an Array of Variables or a String. | ||
**Signature Definition**: Give arg 1 an Array or a String; Get an Array of variables. | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String. Get an Array of Variables. | ||
@@ -270,7 +289,7 @@ **Example Usage**: | ||
<a name='nil'/> | ||
### nil : arr|str -> boolean | ||
### nil : [x]|str -> boolean | ||
------ | ||
**Description**: Test if an Array or String is empty. | ||
**Description**: Test if an Array of Variables or String is empty. | ||
**Signature Definition**: Give arg 1 an Array or a String; Get a boolean. | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String; Get a boolean. | ||
@@ -290,5 +309,5 @@ **Example Usage**: | ||
------ | ||
**Description**: Array returned by applying f to each element of [x] | ||
**Description**: Array of Variables returned by applying f to each element of [x]. | ||
**Signature Definition**: Give arg 1 an Array or a String; Give arg 2 a Function; Get an Array of variables. | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String. Give arg 2 a Function. Get an Array of Variables. | ||
@@ -308,5 +327,5 @@ **Example Usage**: | ||
------ | ||
**Description**: Array returned by reversing the order of each element. | ||
**Description**: Array of Variables returned by reversing the order of each element. | ||
**Signature Definition**: Give arg 1 an Array or a String; Get an Array of variables. | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String. Get an Array of Variables. | ||
@@ -318,11 +337,11 @@ **Example Usage**: | ||
lists.rev('abc'); /* ['c','b','a'] */ | ||
lists.rev([[2],[3]]) /* [[3],[2]] */ | ||
lists.rev([[2],[3]]); /* [[3],[2]] */ | ||
``` | ||
------ | ||
<a name='intersperse'/> | ||
### intersperse : x -> [x] -> arr|str | ||
### intersperse : x -> [x] -> [x]|str | ||
------ | ||
**Description**: Array or String returned by interspersing a given separator between elements of a given Array. | ||
**Description**: Array of Variables or a String returned by interspersing a given separator between elements of a given Array. | ||
**Signature Definition**: Give arg 1 a variable; Give arg 2 an Array of variables; Get an Array of variables. | ||
**Signature Definition**: Give arg 1 a Variable. Give arg 2 an Array of Variables. Get an Array of Variables or a String. | ||
@@ -341,5 +360,5 @@ **Example Usage**: | ||
------ | ||
**Description**: Array returned by flattening the result of interspersing an Array of varaibles into an Array of Arrays. | ||
**Description**: Array of Variables returned by flattening the result of interspersing an Array of Variables into an Array of an Array of Variables. | ||
**Signature Definition**: Give arg 1 an Array of variables; Give arg 2 an Array of Arrays of variables; Get an Array of variables. | ||
**Signature Definition**: Give arg 1 an Array of Variables. Give arg 2 an Array of an Array of Variables. Get an Array of Variables. | ||
@@ -350,3 +369,3 @@ **Example Usage**: | ||
lists.intercalate([1],[[5],[5],[5]]); /* = lists.flatten(lists.intersperse([1],[[5],[5],[5]])) // [5,1,5,1,5] */ | ||
lists.intercalate(["abc"],[["efg"],["qrs"]]) /* ["efg", "abc", "qrs"] */ | ||
lists.intercalate(["abc"],[["efg"],["qrs"]]); /* ["efg", "abc", "qrs"] */ | ||
lists.intercalate([{a:1}],[[{b:1}],[{c:2}]]); /* [{b:1},{a:1},{c:2}] */ | ||
@@ -358,5 +377,5 @@ ``` | ||
------ | ||
**Description**: Array returned by transposing rows and columns of given arguments. | ||
**Description**: Array of an Array of Variables returned by transposing rows and columns of given arguments. | ||
**Signature Definition**: Give arg 1 an Array of Arrays of variables; Get an Array of Arrays of variables. | ||
**Signature Definition**: Give arg 1 an Array of an Array of Variables. Get an Array of an Array of Variables. | ||
@@ -366,4 +385,4 @@ **Example Usage**: | ||
```js | ||
lists.transpose([[1,2,4],[3,4,4]]) /* [[1,3],[2,4],[4,4]] */ | ||
lists.transpose([["a","b","c"],["a","b","c"]]) /* [["a","a"],["b","b"],["c","c"]] */ | ||
lists.transpose([[1,2,4],[3,4,4]]); /* [[1,3],[2,4],[4,4]] */ | ||
lists.transpose([["a","b","c"],["a","b","c"]]); /* [["a","a"],["b","b"],["c","c"]] */ | ||
``` | ||
@@ -374,5 +393,5 @@ ------ | ||
------ | ||
**Description**: Array of Arrays of all subsequences of a given arguement. | ||
**Description**: Array of an Array of Variables of all subsequences of a given arguement. | ||
**Signature Definition**: Give arg 1 an Array of variables; Get an Array of Arrays of variables. | ||
**Signature Definition**: Give arg 1 an Array of Variables. Get an Array of an Array of Variables. | ||
@@ -382,4 +401,4 @@ **Example Usage**: | ||
```js | ||
lists.subsequences('ab') /* [[],['a'],['b'],['ab']] */ | ||
lists.subsequences([1,2,3]) /* [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]] */ | ||
lists.subsequences('ab'); /* [[],['a'],['b'],['ab']] */ | ||
lists.subsequences([1,2,3]); /* [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]] */ | ||
``` | ||
@@ -390,5 +409,5 @@ ------ | ||
------ | ||
**Description**: Array of Arrays or Array of Strings returned by getting all permutations of a given arguement. | ||
**Description**: Array of an Array of Variables or Array of Strings returned by getting all permutations of a given arguement. | ||
**Signature Definition**: Give arg 1 an Array of variables or a String; Get an Array of Arrays of variables or an Array of Strings respectively. | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String. Get an Array of an Array of Variables or an Array of Strings respectively. | ||
@@ -398,4 +417,4 @@ **Example Usage**: | ||
```js | ||
lists.permutations('abc') /* ["abc","acb","bac","bca","cab","cba"] */ | ||
lists.permutations([1,2,3]) /* [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] */ | ||
lists.permutations('abc'); /* ["abc","acb","bac","bca","cab","cba"] */ | ||
lists.permutations([1,2,3]); /* [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] */ | ||
``` | ||
@@ -406,5 +425,5 @@ ------ | ||
------ | ||
**Description**: Variable returned reducing left to right by applying a binary operator function (f) on a starting variable (x), known as the accumulator, and an Array of variables or String | ||
**Description**: Variable returned reducing left to right by applying a binary operator function (f) on a starting variable (x), known as the accumulator, and an Array of Variables or String. | ||
**Signature Definition**: Give arg 1 a starting variable (usually a left identity of the binary operator); Give arg 2 an Array of variables or a String; Give arg 3 a function (binary operator); Get a variable. | ||
**Signature Definition**: Give arg 1 a starting Variable (usually a left identity of the binary operator). Give arg 2 an Array of Variables or a String. Give arg 3 a function (binary operator). Get a Variable. | ||
@@ -416,3 +435,3 @@ **Example Usage**: | ||
sum = lists.foldl(0,[1,2,3],function(x,y){ return x+y; }); /* 6 */ | ||
lists.foldl([], [[1,2],[3,4]], function(x,y) {return x.concat(y) }) /* [1,2,3,4] */ | ||
lists.foldl([], [[1,2],[3,4]], function(x,y) {return x.concat(y) }); /* [1,2,3,4] */ | ||
``` | ||
@@ -423,5 +442,5 @@ ------ | ||
------ | ||
**Description**: Variant of foldl without a starting variable (The accumulator begins with the 0th index of the passed Array or String). Use with non-empty Arrays or Strings. | ||
**Description**: Variant of foldl without a starting variable (The accumulator begins with the 0th index of the passed Array of Variables or String). Use with non-empty Arrays or Strings. | ||
**Signature Definition**: Give arg 1 an Array of variables or a String; Give arg 2 a function (binary operator); Get a variable. | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String. Give arg 2 a function (binary operator). Get a Variable. | ||
@@ -431,4 +450,4 @@ **Example Usage**: | ||
```js | ||
lists.foldl1('abc',function(x,y){ return x.concat(y).toUpperCase() }) /* "ABC" */ | ||
lists.foldl1([1,2,3],function(x,y){ return x+y }) /* 6 */ | ||
lists.foldl1('abc',function(x,y){ return x.concat(y).toUpperCase() }); /* "ABC" */ | ||
lists.foldl1([1,2,3],function(x,y){ return x+y }); /* 6 */ | ||
``` | ||
@@ -439,5 +458,5 @@ ------ | ||
------ | ||
**Description**: Variable returned reducing right to left by applying a binary operator function (f) on a starting variable (x), known as the accumulator, and an Array of variables or String | ||
**Description**: Variable returned reducing right to left by applying a binary operator function (f) on a starting Variable (x), known as the accumulator, and an Array of Variables or String. | ||
**Signature Definition**: Give arg 1 a starting variable (usually a right identity of the binary operator); Give arg 2 an Array of variables or a String; Give arg 3 a function (binary operator); Get a variable. | ||
**Signature Definition**: Give arg 1 a starting Variable (usually a right identity of the binary operator). Give arg 2 an Array of Variables or a String. Give arg 3 a Function (binary operator). Get a Variable. | ||
@@ -447,3 +466,3 @@ **Example Usage**: | ||
```js | ||
lists.foldr(0,[1,2,3,4],function(x,y){ return x-y; }) /* -2 */ | ||
lists.foldr(0,[1,2,3,4],function(x,y){ return x-y; }); /* -2 */ | ||
lists.foldr([],[[1,2],[3,4],[5,6]],function(x,y){ | ||
@@ -457,5 +476,5 @@ return lists.rev(x).concat(y); | ||
------ | ||
**Description**: Variant of foldr without a starting variable (The accumulator begins with the 0th index of the passed Array or String). Use with non-empty Arrays or Strings. | ||
**Description**: Variant of foldr without a starting Variable (The accumulator begins with the 0th index of the passed Array or String). Use with non-empty Arrays or Strings. | ||
**Signature Definition**: Give arg 1 an Array of variables or a String; Give arg 2 a function (binary operator); Get a variable. | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String. Give arg 2 a Function (binary operator). Get a Variable. | ||
@@ -465,4 +484,4 @@ **Example Usage**: | ||
```js | ||
lists.foldr1([1,2,3],function(x,y){ return x - y }) /* 3 */ | ||
lists.foldr1('aabbcc',function(x,y){ return x=='a'? x=y : x.concat(y)}) /* "bbcc" */ | ||
lists.foldr1([1,2,3],function(x,y){ return x - y }); /* 3 */ | ||
lists.foldr1('aabbcc',function(x,y){ return x=='a'? x=y : x.concat(y)}); /* "bbcc" */ | ||
``` | ||
@@ -473,5 +492,5 @@ ------ | ||
------ | ||
**Description**: Flatten an Array of Arrays or an Array of String into an Array of variables or String respectively. | ||
**Description**: Flatten an Array of an Array of Variables or an Array of Strings into an Array of Variables or String respectively. | ||
**Signature Definition**: Give arg 1 an Array of Arrays of variables or a String; Get an Array of variables or a String | ||
**Signature Definition**: Give arg 1 an Array of an Array of Variables or an Array of Strings. Get an Array of Variables or a String. | ||
@@ -482,3 +501,3 @@ **Example Usage**: | ||
lists.flatten(['abc']); /* 'abc' */ | ||
lists.flatten([[1,2],[3,4]]) /* [1,2,3,4] */ | ||
lists.flatten([[1,2],[3,4]]); /* [1,2,3,4] */ | ||
``` | ||
@@ -489,5 +508,5 @@ ------ | ||
------ | ||
**Description**: Array of variables or String returned by mapping a function over an Array of variables or String and flattening the result | ||
**Description**: Array of Variables or String returned by mapping a Function over an Array of variables or String and flattening the result. | ||
**Signature Definition**: Give arg 1 an Array of variables or a String; Give arg 2 a function that produces an Array of variables or String; Get an Array of variables or a String | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String. Give arg 2 a Function that produces an Array of Variables or String. Get an Array of Variables or a String. | ||
@@ -497,4 +516,4 @@ **Example Usage**: | ||
```js | ||
lists.concatMap(['bang','bang'], function(x){ return x+'!'}) /* "bang!bang!" */ | ||
lists.concatMap([1,2,3],function(x){ return [[x*2,x/2]] }) /* [[2,0.5],[4,1],[6,1.5]] */ | ||
lists.concatMap(['bang','bang'], function(x){ return x+'!'}); /* "bang!bang!" */ | ||
lists.concatMap([1,2,3],function(x){ return [[x*2,x/2]] }); /* [[2,0.5],[4,1],[6,1.5]] */ | ||
lists.concatMap([{a:1},{b:2}], function(x){ | ||
@@ -516,4 +535,4 @@ x.prop = 'hi'; | ||
```js | ||
lists.and([5>1,5>2,5>3]) /* true */ | ||
lists.and([5>1,false,5>3]) /* false */ | ||
lists.and([5>1,5>2,5>3]); /* true */ | ||
lists.and([5>1,false,5>3]); /* false */ | ||
``` | ||
@@ -531,4 +550,4 @@ ------ | ||
```js | ||
lists.or([5<1,5<2,5>3]) /* true */ | ||
lists.or([5<1,5<2,5<3]) /* false */ | ||
lists.or([5<1,5<2,5>3]); /* true */ | ||
lists.or([5<1,5<2,5<3]); /* false */ | ||
``` | ||
@@ -539,5 +558,5 @@ ------ | ||
------ | ||
**Description**: Boolean returned by applying a predicate function to each element in an Array of variables or String. True if at least one f(x) is true. False if all f(x) are false. | ||
**Description**: Boolean returned by applying a predicate Function to each element in an Array of Variables or a String. True if at least one f(x) is true. False if all f(x) are false. | ||
**Signature Definition**: Give arg 1 an Array of variables or String; Give arg 2 a predicate function to be applied to each element of arg 1; Get a boolean. | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String. Give arg 2 a predicate Function to be applied to each element of arg 1. Get a boolean. | ||
@@ -547,4 +566,4 @@ **Example Usage**: | ||
```js | ||
lists.any([1,2,3],function(x) { return x < .5}) /* false */ | ||
lists.any('abc',function(x) { return x == 'b'}) /* true */ | ||
lists.any([1,2,3],function(x) { return x < .5}); /* false */ | ||
lists.any('abc',function(x) { return x == 'b'}); /* true */ | ||
``` | ||
@@ -555,5 +574,5 @@ ------ | ||
------ | ||
**Description**: Boolean returned by applying a predicate function to each element in an Array of variables or String. True if all f(x) are true. False if any f(x) are false. | ||
**Description**: Boolean returned by applying a predicate Function to each element in an Array of Variables or String. True if all f(x) are true. False if any f(x) are false. | ||
**Signature Definition**: Give arg 1 an Array of variables or String; Give arg 2 a predicate function to be applied to each element of arg 1; Get a boolean. | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String. Give arg 2 a predicate Function to be applied to each element of arg 1. Get a boolean. | ||
@@ -563,5 +582,5 @@ **Example Usage**: | ||
```js | ||
lists.all('abc', function(x){ return x==x.toUpperCase() }) /* false */ | ||
lists.all([2,4], function(x) { return x > 3 }) /* false */ | ||
lists.all([2,4], function(x) { return x%2==0 }) /* true */ | ||
lists.all('abc', function(x){ return x==x.toUpperCase() }); /* false */ | ||
lists.all([2,4], function(x) { return x > 3 }); /* false */ | ||
lists.all([2,4], function(x) { return x%2==0 }); /* true */ | ||
``` | ||
@@ -574,3 +593,3 @@ ------ | ||
**Signature Definition**: Give arg 1 an Array of Numbers; Get a number. | ||
**Signature Definition**: Give arg 1 an Array of Numbers. Get a Number. | ||
@@ -580,4 +599,4 @@ **Example Usage**: | ||
```js | ||
lists.sum([2,4,6]) /* 12 */ | ||
lists.sum([.2,.4,.6]) /* 1.2000000000000002 */ | ||
lists.sum([2,4,6]); /* 12 */ | ||
lists.sum([.2,.4,.6]); /* 1.2000000000000002 */ | ||
``` | ||
@@ -590,3 +609,3 @@ ------ | ||
**Signature Definition**: Give arg 1 an Array of Numbers; Get a number. | ||
**Signature Definition**: Give arg 1 an Array of Numbers. Get a Number. | ||
@@ -596,4 +615,4 @@ **Example Usage**: | ||
```js | ||
lists.product([2,4,6]) /* 48 */ | ||
lists.product([.2,.4,.6]) /* 0.04800000000000001 */ | ||
lists.product([2,4,6]); /* 48 */ | ||
lists.product([.2,.4,.6]); /* 0.04800000000000001 */ | ||
``` | ||
@@ -604,5 +623,5 @@ ------ | ||
------ | ||
**Description**: Maximum number returned from numbers of an Array. | ||
**Description**: Maximum Number returned from numbers of an Array. | ||
**Signature Definition**: Give arg 1 an Array of Numbers; Get a number. | ||
**Signature Definition**: Give arg 1 an Array of Numbers. Get a Number. | ||
@@ -612,4 +631,4 @@ **Example Usage**: | ||
```js | ||
lists.maximum([2,4,6]) /* 6 */ | ||
lists.maximum([.2,.4,.6]) /* .6 */ | ||
lists.maximum([2,4,6]); /* 6 */ | ||
lists.maximum([.2,.4,.6]); /* .6 */ | ||
``` | ||
@@ -620,5 +639,5 @@ ------ | ||
------ | ||
**Description**: Minimum number returned from numbers of an Array. | ||
**Description**: Minimum Number returned from numbers of an Array. | ||
**Signature Definition**: Give arg 1 an Array of Numbers; Get a number. | ||
**Signature Definition**: Give arg 1 an Array of Numbers. Get a Number. | ||
@@ -628,4 +647,4 @@ **Example Usage**: | ||
```js | ||
lists.minimum([2,4,6]) /* 2 */ | ||
lists.minimum([.2,.4,.6]) /* .2 */ | ||
lists.minimum([2,4,6]); /* 2 */ | ||
lists.minimum([.2,.4,.6]); /* .2 */ | ||
``` | ||
@@ -636,5 +655,5 @@ ------ | ||
------ | ||
**Description**: Array of variables with the maximum length returned from an Array of Arrays of variables. | ||
**Description**: Array of Variables with the maximum length returned from an Array of an Array of Variables. | ||
**Signature Definition**: Give arg 1 an Array of Arrays of variables; Get an Array of variables. | ||
**Signature Definition**: Give arg 1 an Array of an Array of Variables. Get an Array of Variables. | ||
@@ -644,4 +663,4 @@ **Example Usage**: | ||
```js | ||
lists.maxList([[1],[2,3]]) /* [2,3] */ | ||
lists.maxList([[1,2],[3]]) /* [1,2] */ | ||
lists.maxList([[1],[2,3]]); /* [2,3] */ | ||
lists.maxList([[1,2],[3]]); /* [1,2] */ | ||
``` | ||
@@ -652,5 +671,5 @@ ------ | ||
------ | ||
**Description**: Array of variables with the minimum length returned from an Array of Arrays of variables. | ||
**Description**: Array of Variables with the minimum length returned from an Array of an Array of Variables. | ||
**Signature Definition**: Give arg 1 an Array of Arrays of variables; Get an Array of variables. | ||
**Signature Definition**: Give arg 1 an Array of an Array of Variables. Get an Array of Variables. | ||
@@ -660,4 +679,4 @@ **Example Usage**: | ||
```js | ||
lists.minList([[],[1]]) /* [] */ | ||
lists.minList([[1,2],[3]]) /* [3] */ | ||
lists.minList([[],[1]]); /* [] */ | ||
lists.minList([[1,2],[3]]); /* [3] */ | ||
``` | ||
@@ -668,5 +687,5 @@ ------ | ||
------ | ||
**Description**: Array of variables returned building left to right, starting with the accumulator (x) by applying a binary operator function (f) on a starting variable (x) and an Array of variables or String | ||
**Description**: Array of Variables returned building left to right, starting with the accumulator (x) by applying a binary operator Function (f) on a starting Variable (x) and an Array of Variables or a String. | ||
**Signature Definition**: Give arg 1 a starting variable; Give arg 2 an Array of variables or a String; Give arg 3 a function (binary operator); Get an Array of variables. | ||
**Signature Definition**: Give arg 1 a starting Variable. Give arg 2 an Array of Variables or a String. Give arg 3 a Function (binary operator). Get an Array of Variables. | ||
@@ -676,4 +695,4 @@ **Example Usage**: | ||
```js | ||
lists.scanl('.','abc',function(x,y){return x + y}) /* [".",".a",".ab",".abc"] */ | ||
lists.scanl(0,[1,2,3],function(x,y){return x + y}) /* [0,1,3,6] */ | ||
lists.scanl('.','abc',function(x,y){return x + y}); /* [".",".a",".ab",".abc"] */ | ||
lists.scanl(0,[1,2,3],function(x,y){return x + y}); /* [0,1,3,6] */ | ||
``` | ||
@@ -684,5 +703,5 @@ ------ | ||
------ | ||
**Description**: Array of variables returned building right to left, starting with the accumulator (x) by applying a binary operator function (f) on a starting variable (x) and an Array of variables or String | ||
**Description**: Array of Variables returned building right to left, starting with the accumulator (x) by applying a binary operator Function (f) on a starting Variable (x) and an Array of Variables or a String. | ||
**Signature Definition**: Give arg 1 a starting variable; Give arg 2 an Array of variables or a String; Give arg 3 a function (binary operator); Get an Array of variables. | ||
**Signature Definition**: Give arg 1 a starting Variable. Give arg 2 an Array of Variables or a String. Give arg 3 a Function (binary operator). Get an Array of Variables. | ||
@@ -692,4 +711,4 @@ **Example Usage**: | ||
```js | ||
lists.scanr('.','abc',function(x,y){return x + y}) /* ["abc.","bc.","c.","."] */ | ||
lists.scanr(0,[1,2,3],function(x,y){return x + y}) /* [6,5,3,0] */ | ||
lists.scanr('.','abc',function(x,y){return x + y}); /* ["abc.","bc.","c.","."] */ | ||
lists.scanr(0,[1,2,3],function(x,y){return x + y}); /* [6,5,3,0] */ | ||
``` | ||
@@ -700,5 +719,5 @@ ------ | ||
------ | ||
**Description**: Builds an Array containing a accumulator (x) and the result of applying f to the supplied accumulator and each element of the supplied Array from left to right. | ||
**Description**: Builds an Array containing a accumulator (x) and the result of applying F to the supplied accumulator and each element of the supplied Array from left to right. | ||
**Signature Definition**: Give arg 1 a starting variable (accumulator); Give arg 2 an Array of variables or a String; Give arg 3 a function; Get an Array of variable followed by Array of variables. | ||
**Signature Definition**: Give arg 1 a starting Variable (accumulator). Give arg 2 an Array of Variables or a String. Give arg 3 a Function. Get an Array of Variable followed by Array of Variables. | ||
@@ -708,5 +727,5 @@ **Example Usage**: | ||
```js | ||
lists.mapAccumL(5, [2,4,8], function(x,y){ return [x+y,x*y]}) /* [19, [10,28,88]]*/ | ||
lists.mapAccumL(5, [2,4,8], function(x,y){ return [y,y]}) /* [8, [2,4,8]] */ | ||
lists.mapAccumL(5, [5,5,5], function(x,y){ return [x,x]}) /* [5, [5,5,5]] */ | ||
lists.mapAccumL(5, [2,4,8], function(x,y){ return [x+y,x*y]}); /* [19, [10,28,88]]*/ | ||
lists.mapAccumL(5, [2,4,8], function(x,y){ return [y,y]}); /* [8, [2,4,8]] */ | ||
lists.mapAccumL(5, [5,5,5], function(x,y){ return [x,x]}); /* [5, [5,5,5]] */ | ||
``` | ||
@@ -719,3 +738,3 @@ ------ | ||
**Signature Definition**: Give arg 1 a starting variable (accumulator); Give arg 2 an Array of variables or a String; Give arg 3 a function; Get an Array of variable followed by Array of variables. | ||
**Signature Definition**: Give arg 1 a starting Variable (accumulator). Give arg 2 an Array of Variables or a String. Give arg 3 a Function. Get an Array of Variable followed by Array of Variables. | ||
@@ -725,5 +744,5 @@ **Example Usage**: | ||
```js | ||
lists.mapAccumR(5, [2,4,8], function(x,y){ return [x+y,x*y]}) /* [19, [34,52,40]]*/ | ||
lists.mapAccumR(5, [2,4,8], function(x,y){ return [y,y]}) /* [2, [2,4,8]] */ | ||
lists.mapAccumR(5, [5,5,5], function(x,y){ return [x,x]}) /* [5, [5,5,5]] */ | ||
lists.mapAccumR(5, [2,4,8], function(x,y){ return [x+y,x*y]}); /* [19, [34,52,40]]*/ | ||
lists.mapAccumR(5, [2,4,8], function(x,y){ return [y,y]}); /* [2, [2,4,8]] */ | ||
lists.mapAccumR(5, [5,5,5], function(x,y){ return [x,x]}); /* [5, [5,5,5]] */ | ||
``` | ||
@@ -736,3 +755,3 @@ ------ | ||
**Signature Definition**: Give arg 1 a variable; Give arg 2 a number; Give arg 3 a function; Get an Array of variables. | ||
**Signature Definition**: Give arg 1 a Variable. Give arg 2 a Number. Give arg 3 a Function. Get an Array of Variables. | ||
@@ -742,5 +761,5 @@ **Example Usage**: | ||
```js | ||
lists.iterate('a',3,function(ch){return ch+'b'}) /* ["a","ab","abb"] */ | ||
lists.iterate([1,2],3,function(xs){return lists.intersperse(6,xs)}) /* [[1,2],[1,6,2],[1,6,6,6,2]] */ | ||
lists.iterate(2,4,function(x){ return x*x }) /* [2,4,16,256] */ | ||
lists.iterate('a',3,function(ch){return ch+'b'}); /* ["a","ab","abb"] */ | ||
lists.iterate([1,2],3,function(xs){return lists.intersperse(6,xs)}); /* [[1,2],[1,6,2],[1,6,6,6,2]] */ | ||
lists.iterate(2,4,function(x){ return x*x }); /* [2,4,16,256] */ | ||
``` | ||
@@ -753,3 +772,3 @@ ------ | ||
**Signature Definition**: Give arg 1 a variable; Give arg 2 a number; Get an Array of variables. | ||
**Signature Definition**: Give arg 1 a Variable. Give arg 2 a Number. Get an Array of Variables. | ||
@@ -759,5 +778,5 @@ **Example Usage**: | ||
```js | ||
lists.replicate(5,5) /* [5,5,5,5,5] */ | ||
lists.replicate([1,2],2) /* [[1,2],[1,2]] */ | ||
lists.replicate({a:1},2) /* [{a:1},{a:2}] */ | ||
lists.replicate(5,5); /* [5,5,5,5,5] */ | ||
lists.replicate([1,2],2); /* [[1,2],[1,2]] */ | ||
lists.replicate({a:1},2); /* [{a:1},{a:2}] */ | ||
``` | ||
@@ -770,3 +789,3 @@ ------ | ||
**Signature Definition**: Give arg 1 an Array of variables; Give arg 2 a number; Get an Array of variables. | ||
**Signature Definition**: Give arg 1 an Array of Variables. Give arg 2 a Number. Get an Array of Variables. | ||
@@ -776,4 +795,4 @@ **Example Usage**: | ||
```js | ||
lists.cycle('abc',3) /* "abcabcabc" */ | ||
lists.cycle([1,2],2) /* [1,2,1,2] */ | ||
lists.cycle('abc',3); /* "abcabcabc" */ | ||
lists.cycle([1,2],2); /* [1,2,1,2] */ | ||
``` | ||
@@ -784,5 +803,5 @@ ------ | ||
------ | ||
**Description**: Builds an Array from a seed value. Arg 1 is the predicate function. If the predicate fails, return an empty Array, otherwise concatenate the result of Arg 2 (f) applied to Arg 4 (x) to the recursive call of unfold calling Arg 3 (f) to Arg 4 (x). This is a corecursive anamorphism. | ||
**Description**: Builds an Array from a seed value. Arg 1 is the predicate Function. If the predicate fails, return an empty Array, otherwise concatenate the result of Arg 2 (f) applied to Arg 4 (x) to the recursive call of unfold calling Arg 3 (f) to Arg 4 (x). This is a corecursive anamorphism. | ||
**Signature Definition**: Give arg 1 an function (predicate); Give arg 2 a function; Give arg 3 a function; Give arg 4 a variable (seed). | ||
**Signature Definition**: Give arg 1 an Function (predicate). Give arg 2 a Function. Give arg 3 a Function. Give arg 4 a Variable (seed). | ||
@@ -795,3 +814,3 @@ **Example Usage**: | ||
} | ||
chop8([1,2,3,4,5,6,7,8,9]) /* [[1,2,3,4,5,6,7,8],[9]] */ | ||
chop8([1,2,3,4,5,6,7,8,9]); /* [[1,2,3,4,5,6,7,8],[9]] */ | ||
@@ -805,3 +824,3 @@ function unfoldMap(xs,f) { | ||
} | ||
unfoldMap([1,2],function(x){ return x * 2 }) /* [2,4] */ | ||
unfoldMap([1,2],function(x){ return x * 2 }); /* [2,4] */ | ||
``` | ||
@@ -812,5 +831,5 @@ ------ | ||
------ | ||
**Description**: Array of variables returned by taking the first n (num) elements from [x] or String. | ||
**Description**: Array of Variables returned by taking the first n (num) elements from [x] or String. | ||
**Signature Definition**: Give arg 1 a number; Give arg 2 an Array of variables or String; Get an Array of variables. | ||
**Signature Definition**: Give arg 1 a Number. Give arg 2 an Array of Variables or a String. Get an Array of Variables. | ||
@@ -820,4 +839,4 @@ **Example Usage**: | ||
```js | ||
lists.take(2,[1,2,3]) /* [1,2] */ | ||
lists.take(2,'abc') /* ["a","b"] */ | ||
lists.take(2,[1,2,3]); /* [1,2] */ | ||
lists.take(2,'abc'); /* ["a","b"] */ | ||
``` | ||
@@ -828,5 +847,5 @@ ------ | ||
------ | ||
**Description**: Array of variables returned by dropping the first n (num) elements from [x] or String. | ||
**Description**: Array of Variables returned by dropping the first n (num) elements from [x] or String. | ||
**Signature Definition**: Give arg 1 a number; Give arg 2 an Array of variables or String; Get an Array of variables. | ||
**Signature Definition**: Give arg 1 a Number. Give arg 2 an Array of Variables or a String. Get an Array of Variables. | ||
@@ -836,4 +855,4 @@ **Example Usage**: | ||
```js | ||
lists.drop(2,[1,2,3]) /* [3] */ | ||
lists.drop(2,'abc') /* ["c"] */ | ||
lists.drop(2,[1,2,3]); /* [3] */ | ||
lists.drop(2,'abc'); /* ["c"] */ | ||
``` | ||
@@ -844,5 +863,5 @@ ------ | ||
------ | ||
**Description**: Array of two Arrays returned. The first Array contains the first n elements of the supplied Array of variables or String. The second contains the rest. | ||
**Description**: Array of two Arrays returned. The first Array contains the first n elements of the supplied Array of Variables or String. The second contains the rest. | ||
**Signature Definition**: Give arg 1 a number; Give arg 2 an Array of variables or String; Get an Array of two Arrays of variables. | ||
**Signature Definition**: Give arg 1 a Number. Give arg 2 an Array of Variables or a String. Get an Array of two Arrays of Variables. | ||
@@ -859,5 +878,5 @@ **Example Usage**: | ||
------ | ||
**Description**: Array of variables returned by taking elements from [x]|String that satisfy a supplied predicate function until that predicate function is unsatisfied. | ||
**Description**: Array of Variables returned by taking elements from [x]|String that satisfy a supplied predicate Function until that predicate Function is unsatisfied. | ||
**Signature Definition**: Give arg 1 a function; Give arg 2 an Array of variables or String; Get an Array of variables. | ||
**Signature Definition**: Give arg 1 a Function. Give arg 2 an Array of Variables or a String. Get an Array of Variables. | ||
@@ -867,5 +886,5 @@ **Example Usage**: | ||
```js | ||
lists.takeWhile([1,2,3,1], function(x){ return x < 3 }) /* [1,2] */ | ||
lists.takeWhile([1], function(x){ return x < 2 }) /* [1] */ | ||
lists.takeWhile('aabc', function(x){ return x =='a' }) /* ["a","a"] */ | ||
lists.takeWhile([1,2,3,1], function(x){ return x < 3 }); /* [1,2] */ | ||
lists.takeWhile([1], function(x){ return x < 2 }); /* [1] */ | ||
lists.takeWhile('aabc', function(x){ return x =='a' }); /* ["a","a"] */ | ||
``` | ||
@@ -876,5 +895,5 @@ ------ | ||
------ | ||
**Description**: Array of variables returned by dropping elements from [x]|String that satisfy a supplied predicate function until that predicate function is unsatisfied. | ||
**Description**: Array of Variables returned by dropping elements from [x]|String that satisfy a supplied predicate Function until that predicate Function is unsatisfied. | ||
**Signature Definition**: <span class='sig-def'>Give arg 1 a function; Give arg 2 an Array of variables or String; Get an Array of variables.</span> | ||
**Signature Definition**: <span class='sig-def'>Give arg 1 a Function. Give arg 2 an Array of Variables or a String. Get an Array of Variables.</span> | ||
@@ -884,5 +903,5 @@ **Example Usage**: | ||
```js | ||
lists.dropWhile([1,2,3,4], function(x){ return x < 3 }) /* [3,4] */ | ||
lists.dropWhile([1], function(x){ return x < 2 }) /* [2] */ | ||
lists.dropWhile('aabc', function(x){ return x =='a' }) /* ["b","c"] */ | ||
lists.dropWhile([1,2,3,4], function(x){ return x < 3 }); /* [3,4] */ | ||
lists.dropWhile([1], function(x){ return x < 2 }); /* [2] */ | ||
lists.dropWhile('aabc', function(x){ return x =='a' }); /* ["b","c"] */ | ||
``` | ||
@@ -893,5 +912,5 @@ ------ | ||
------ | ||
**Description**: An Array of Array of variables and Array of variables or String (psuedo-tuple) is returned. The first element is the longest prefix of an Array of variables or String that satisfy a predicate function f. The second element is the rest of the list. | ||
**Description**: An Array of an Array of Variables and Array of Variables or a String (psuedo-tuple) is returned. The first element is the longest prefix of an Array of Variables or a String that satisfy a predicate Function f. The second element is the rest of the list. | ||
**Signature Definition**: Give arg 1 an Array of variables or String; Give arg 2 a function; Get an Array of Array of variables and Array of variables or String (psuedo-tuple). | ||
**Signature Definition**: Give arg 1 an Array of Variables or String. Give arg 2 a Function. Get an Array of an Array of Variables and Array of Variables or a String (psuedo-tuple). | ||
@@ -901,5 +920,5 @@ **Example Usage**: | ||
```js | ||
lists.span([1,2,3,4], function(x){return x < 3}) /* [[1,2],[3,4]] */ | ||
lists.span("abcde", function(x){return x == "a"}) /* [["a"],["b","c","d","e"]] */ | ||
lists.span([{a:2},{a:2},{b:2}], function(x){return x.a==2}) /* [[{a:2},{a:2}],[{b:2}]] */ | ||
lists.span([1,2,3,4], function(x){return x < 3}); /* [[1,2],[3,4]] */ | ||
lists.span("abcde", function(x){return x == "a"}); /* [["a"],["b","c","d","e"]] */ | ||
lists.span([{a:2},{a:2},{b:2}], function(x){return x.a==2}); /* [[{a:2},{a:2}],[{b:2}]] */ | ||
``` | ||
@@ -910,5 +929,5 @@ ------ | ||
------ | ||
**Description**: An Array of Array of variables and Array of variables or String (psuedo-tuple) is returned. The first element is the longest prefix of an Array of variables or String that do not satisfy a predicate function f. The second element is the rest of the list. | ||
**Description**: An Array of an Array of Variables and Array of Variables or a String (psuedo-tuple) is returned. The first element is the longest prefix of an Array of Variables or a String that do not satisfy a predicate Function f. The second element is the rest of the list. | ||
**Signature Definition**: Give arg 1 an Array of variables or String; Give arg 2 a function; Get an Array of Array of variables and Array of variables or String (psuedo-tuple). | ||
**Signature Definition**: Give arg 1 an Array of Variables or a String. Give arg 2 a Function. Get an Array of an Array of Variables and Array of Variables or a String (psuedo-tuple). | ||
@@ -918,5 +937,5 @@ **Example Usage**: | ||
```js | ||
lists.break([1,2,3,4], function(x){return x < 3}) /* [[],[1,2,3,4]] */ | ||
lists.break("abcde", function(x){return x == "a"}) /* [[],"abcde"] */ | ||
lists.break([{a:2},{a:2},{b:2}], function(x){return x.a==2}) /* [[],[{a:2},{a:2},{b:2}]] */ | ||
lists.break([1,2,3,4], function(x){return x < 3}); /* [[],[1,2,3,4]] */ | ||
lists.break("abcde", function(x){return x == "a"}); /* [[],"abcde"] */ | ||
lists.break([{a:2},{a:2},{b:2}], function(x){return x.a==2}); /* [[],[{a:2},{a:2},{b:2}]] */ | ||
``` | ||
@@ -929,3 +948,3 @@ ------ | ||
**Signature Definition**: Give arg 1 an Array of Numbers or String; Give arg 2 an Array of Numbers or String; Get an Array of Numbers or an Array of Strings. | ||
**Signature Definition**: Give arg 1 an Array of Numbers or String. Give arg 2 an Array of Numbers or String. Get an Array of Numbers or an Array of Strings. | ||
@@ -935,5 +954,152 @@ **Example Usage**: | ||
```js | ||
lists.stripPrefix("abc","abcabce") /* ["a","b","c","e"] */ | ||
lists.stripPrefix([1,2],[1,2,3,4]) /* [3,4] */ | ||
lists.stripPrefix("abc","abcabce"); /* ["a","b","c","e"] */ | ||
lists.stripPrefix([1,2],[1,2,3,4]); /* [3,4] */ | ||
``` | ||
------ | ||
<a name='group'/> | ||
### group : [num]|str -> [[num]]|[[str]] | ||
------ | ||
**Description**: An Array of an Array of Numbers or Strings returned where each nested Array contains only equal elements. | ||
**Signature Definition**: Give arg 1 an Array of Numbers or a String. Get an Array of an Array of Numbers or Strings. | ||
**Example Usage**: | ||
```js | ||
lists.group([1,1,2,3,3]); /* [[1,1],[2],[3,3]] */ | ||
lists.group("mississippi"); /* [["m"],["i"],["s","s"],["i"],["s","s"],["i"],["p","p"],["i"]] */ | ||
``` | ||
------ | ||
<a name='inits'/> | ||
### inits : [x] -> [[x]] | ||
------ | ||
**Description**: An Array of an Array of Variables returned with all the initial segments of the argument, shortest first. | ||
**Signature Definition**: Give arg 1 an Array of Variables. Get an Array of an Array of Variables. | ||
**Example Usage**: | ||
```js | ||
lists.inits([1,2,3]); /* [[],[1],[1,2],[1,2,3]] */ | ||
lists.inits("abc"); /* [[],["a"],["a","b"],["a","b","c"]] */ | ||
lists.inits([{a:2},{b:3}]); /* [[],[{a:2}],[{a:2},{b:3}]] */ | ||
``` | ||
------ | ||
<a name='tails'/> | ||
### tails : [x] -> [[x]] | ||
------ | ||
**Description**: An Array of an Array of Variables returned with all the initial segments of the argument, longest first. | ||
**Signature Definition**: Give arg 1 an Array of Variables. Get an Array of an Array of Variables. | ||
**Example Usage**: | ||
```js | ||
lists.tails([1,2,3]); /* [[1,2,3],[1,2],[1],[]] */ | ||
lists.tails("abc"); /* [["a","b","c"],["a","b"],["a"],[]] */ | ||
lists.tails([{a:2},{b:3}]); /* [[{a:2},{b:3}],[{a:2}],[]] */ | ||
``` | ||
------ | ||
<a name='isPrefixOf'/> | ||
### isPrefixOf : [num]|str -> [num]|str -> boolean | ||
------ | ||
**Description**: Test if an Array of Numbers or String is the prefix of an Array of Numbers or a String. The arguments must be of the same type. | ||
**Signature Definition**: Give arg 1 an Array of Numbers or String. Give arg 2 an Array of Numbers or a String. Get a boolean. | ||
**Example Usage**: | ||
```js | ||
lists.isPrefixOf([1,2],[1,2,3]); /* true */ | ||
lists.isPrefixOf("abc","acd"); /* false */ | ||
lists.isPrefixOf("ab","abcd"); /* true */ | ||
``` | ||
------ | ||
<a name='isSuffixOf'/> | ||
### isSuffixOf : [num]|str -> [num]|str -> boolean | ||
------ | ||
**Description**: Test if an Array of Numbers or String is the suffix of an Array of Numbers or a String. The arguments must be of the same type. | ||
**Signature Definition**: Give arg 1 an Array of Numbers or String. Give arg 2 an Array of Numbers or a String. Get a boolean. | ||
**Example Usage**: | ||
```js | ||
lists.isSuffixOf([1,2],[1,2,3]); /* false */ | ||
lists.isSuffixOf("cd","acd"); /* true */ | ||
lists.isSuffixOf("d","abcd"); /* true */ | ||
``` | ||
------ | ||
<a name='isInfixOf'/> | ||
### isInfixOf : [num]|str -> [num]|str -> boolean | ||
------ | ||
**Description**: Test if an Array of Numbers or a String is the infix of an Array of Numbers or a String. The arguments must be of the same type. | ||
**Signature Definition**: Give arg 1 an Array of Numbers or a String. Give arg 2 an Array of Numbers or a String. Get a boolean. | ||
**Example Usage**: | ||
```js | ||
lists.isInfixOf([1,2],[1,3,2]); /* false */ | ||
lists.isInfixOf("cd","acde"); /* true */ | ||
lists.isInfixOf("a","abcd"); /* true */ | ||
``` | ||
------ | ||
<a name='isSubsequenceOf'/> | ||
### isInfixOf : [num]|str -> [num]|str -> boolean | ||
------ | ||
**Description**: Test if an Array of Numbers or String is the subsequence of an Array of Numbers or a String. The arguments must be of the same type. | ||
**Signature Definition**: Give arg 1 an Array of Numbers or String. Give arg 2 an Array of Numbers or a String. Get a boolean. | ||
**Example Usage**: | ||
```js | ||
lists.isSubsequenceOf([1,2],[1,3,2]); /* true */ | ||
lists.isSubsequenceOf("abc","123 abc"); /* true */ | ||
lists.isSubsequenceOf("Lol","Laugh out loud"); /* true */ | ||
``` | ||
------ | ||
<a name='elem'/> | ||
### elem : num|str -> [num]|str -> boolean | ||
------ | ||
**Description**: Test if the Number or String is in the Array of Numbers or a String. | ||
**Signature Definition**: Give arg 1 a Number or String. Give arg 2 an Array of Numbers or a String. Get a boolean. | ||
**Example Usage**: | ||
```js | ||
lists.elem(2,[1,3,2]); /* true */ | ||
lists.elem("2","123 abc"); /* true */ | ||
``` | ||
------ | ||
<a name='notElem'/> | ||
### notElem : num|str -> [num]|str -> boolean | ||
------ | ||
**Description**: Test if the Number or String is not in the Array of Numbers or a String. | ||
**Signature Definition**: Give arg 1 a Number or String. Give arg 2 an Array of Numbers or a String. Get a boolean. | ||
**Example Usage**: | ||
```js | ||
lists.notElem(0,[1,3,2]); /* true */ | ||
lists.notElem("a","abc"); /* false */ | ||
``` | ||
------ | ||
<a name='lookup'/> | ||
### lookup : num|str -> [[num|str,x]] -> boolean | ||
------ | ||
**Description**: Retreive the value of a key in an Array of an Array of Variables where position 0 is the key and position 1 is the value (associative array). | ||
**Signature Definition**: Give arg 1 a Number or String. Give arg 2 an Array of an Array containing a Number or String as the key and a Variable as the value. Get a Variable (value). | ||
**Example Usage**: | ||
```js | ||
lists.lookup("a",[["a",2],["b",3]]); /* 2 */ | ||
lists.lookup("ab",[["ab",2],["b",3]]); /* 2 */ | ||
lists.lookup(1,[[1,{a:2}],["b",3]]); /* {a:2} */ | ||
``` | ||
------ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51647
574
1018