Created
January 13, 2016 23:11
-
-
Save hdgarrood/56c437163745b250b48d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/docs/Data/Array.md b/docs/Data/Array.md | |
index 4e4a3d9..8bd12a4 100644 | |
--- a/docs/Data/Array.md | |
+++ b/docs/Data/Array.md | |
@@ -101,6 +101,8 @@ termination. | |
null :: forall a. Array a -> Boolean | |
``` | |
+Test whether an array is empty. | |
+ | |
#### `length` | |
``` purescript | |
@@ -115,6 +117,14 @@ Get the number of elements in an array. | |
cons :: forall a. a -> Array a -> Array a | |
``` | |
+Attaches an element to the front of an array, creating a new array. | |
+ | |
+```purescript | |
+cons 1 [2, 3, 4] = [1, 2, 3, 4] | |
+``` | |
+ | |
+Note, the running time of this function is `O(n)`. | |
+ | |
#### `(:)` | |
``` purescript | |
@@ -158,6 +168,10 @@ determine the ordering of elements. | |
head :: forall a. Array a -> Maybe a | |
``` | |
+Get the first element in an array, or `Nothing` if the array is empty | |
+ | |
+Running time: `O(1)`. | |
+ | |
#### `last` | |
``` purescript | |
@@ -215,6 +229,9 @@ f arr = case uncons arr of | |
index :: forall a. Array a -> Int -> Maybe a | |
``` | |
+This function provides a safe way to read a value at a particular index | |
+from an array. | |
+ | |
#### `(!!)` | |
``` purescript | |
@@ -309,6 +326,8 @@ index is out-of-bounds. | |
reverse :: forall a. Array a -> Array a | |
``` | |
+Reverse an array, creating a new array. | |
+ | |
#### `concat` | |
``` purescript | |
@@ -372,6 +391,8 @@ a value, creating a new array. | |
sort :: forall a. (Ord a) => Array a -> Array a | |
``` | |
+Sort the elements of an array in increasing order, creating a new array. | |
+ | |
#### `sortBy` | |
``` purescript | |
@@ -387,6 +408,8 @@ the specified partial ordering, creating a new array. | |
slice :: forall a. Int -> Int -> Array a -> Array a | |
``` | |
+Extract a subarray by a start and end index. | |
+ | |
#### `take` | |
``` purescript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment