Skip to content

Commit

Permalink
Add S.append
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Pflug committed Apr 25, 2016
1 parent 86bb222 commit 3002ecb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2274,6 +2274,24 @@
return n < 0 || negativeZero(n) ? Nothing() : slice(0, -n, xs);
});

//# append :: a -> [a] -> [a]
//.
//. Takes a value of any type and a list of values of that type, and
//. returns the result of appending the value to the list.
//.
//. ```javascript
//. > S.append(3, [1, 2])
//. [1, 2, 3]
//.
//. > S.append([3, 4], [[1], [2]])
//. [[1], [2], [3, 4]]
//. ```
S.append =
def('append',
{},
[a, $.Array(a), $.Array(a)],
function(x, xs) { return xs.concat([x]); });

// ArrayLike :: TypeClass
var ArrayLike = $.TypeClass(
'ArrayLike',
Expand Down

0 comments on commit 3002ecb

Please sign in to comment.