Skip to content

Commit bf7dd08

Browse files
committed
compiled docs
1 parent 342b89e commit bf7dd08

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

docs/Data/Array.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ termination.
101101
null :: forall a. Array a -> Boolean
102102
```
103103

104+
Test whether an array is empty.
105+
104106
#### `length`
105107

106108
``` purescript
@@ -115,6 +117,14 @@ Get the number of elements in an array.
115117
cons :: forall a. a -> Array a -> Array a
116118
```
117119

120+
Attaches an element to the front of an array, creating a new array.
121+
122+
```purescript
123+
cons 1 [2, 3, 4] = [1, 2, 3, 4]
124+
```
125+
126+
Note, the running time of this function is `O(n)`.
127+
118128
#### `(:)`
119129

120130
``` purescript
@@ -158,6 +168,10 @@ determine the ordering of elements.
158168
head :: forall a. Array a -> Maybe a
159169
```
160170

171+
Get the first element in an array, or `Nothing` if the array is empty
172+
173+
Running time: `O(1)`.
174+
161175
#### `last`
162176

163177
``` purescript
@@ -215,6 +229,9 @@ f arr = case uncons arr of
215229
index :: forall a. Array a -> Int -> Maybe a
216230
```
217231

232+
This function provides a safe way to read a value at a particular index
233+
from an array.
234+
218235
#### `(!!)`
219236

220237
``` purescript
@@ -309,6 +326,8 @@ index is out-of-bounds.
309326
reverse :: forall a. Array a -> Array a
310327
```
311328

329+
Reverse an array, creating a new array.
330+
312331
#### `concat`
313332

314333
``` purescript
@@ -335,6 +354,16 @@ filter :: forall a. (a -> Boolean) -> Array a -> Array a
335354
Filter an array, keeping the elements which satisfy a predicate function,
336355
creating a new array.
337356

357+
#### `partition`
358+
359+
``` purescript
360+
partition :: forall a. (a -> Boolean) -> Array a -> { yes :: Array a, no :: Array a }
361+
```
362+
363+
Partition an array using a predicate function, creating a set of
364+
new arrays. One for the values satisfying the predicate function
365+
and one for values that don't.
366+
338367
#### `filterM`
339368

340369
``` purescript
@@ -372,6 +401,8 @@ a value, creating a new array.
372401
sort :: forall a. (Ord a) => Array a -> Array a
373402
```
374403

404+
Sort the elements of an array in increasing order, creating a new array.
405+
375406
#### `sortBy`
376407

377408
``` purescript
@@ -387,6 +418,8 @@ the specified partial ordering, creating a new array.
387418
slice :: forall a. Int -> Int -> Array a -> Array a
388419
```
389420

421+
Extract a subarray by a start and end index.
422+
390423
#### `take`
391424

392425
``` purescript

0 commit comments

Comments
 (0)