@@ -101,6 +101,8 @@ termination.
101
101
null :: forall a. Array a -> Boolean
102
102
```
103
103
104
+ Test whether an array is empty.
105
+
104
106
#### ` length `
105
107
106
108
``` purescript
@@ -115,6 +117,14 @@ Get the number of elements in an array.
115
117
cons :: forall a. a -> Array a -> Array a
116
118
```
117
119
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
+
118
128
#### ` (:) `
119
129
120
130
``` purescript
@@ -158,6 +168,10 @@ determine the ordering of elements.
158
168
head :: forall a. Array a -> Maybe a
159
169
```
160
170
171
+ Get the first element in an array, or ` Nothing ` if the array is empty
172
+
173
+ Running time: ` O(1) ` .
174
+
161
175
#### ` last `
162
176
163
177
``` purescript
@@ -215,6 +229,9 @@ f arr = case uncons arr of
215
229
index :: forall a. Array a -> Int -> Maybe a
216
230
```
217
231
232
+ This function provides a safe way to read a value at a particular index
233
+ from an array.
234
+
218
235
#### ` (!!) `
219
236
220
237
``` purescript
@@ -309,6 +326,8 @@ index is out-of-bounds.
309
326
reverse :: forall a. Array a -> Array a
310
327
```
311
328
329
+ Reverse an array, creating a new array.
330
+
312
331
#### ` concat `
313
332
314
333
``` purescript
@@ -335,6 +354,16 @@ filter :: forall a. (a -> Boolean) -> Array a -> Array a
335
354
Filter an array, keeping the elements which satisfy a predicate function,
336
355
creating a new array.
337
356
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
+
338
367
#### ` filterM `
339
368
340
369
``` purescript
@@ -372,6 +401,8 @@ a value, creating a new array.
372
401
sort :: forall a. (Ord a) => Array a -> Array a
373
402
```
374
403
404
+ Sort the elements of an array in increasing order, creating a new array.
405
+
375
406
#### ` sortBy `
376
407
377
408
``` purescript
@@ -387,6 +418,8 @@ the specified partial ordering, creating a new array.
387
418
slice :: forall a. Int -> Int -> Array a -> Array a
388
419
```
389
420
421
+ Extract a subarray by a start and end index.
422
+
390
423
#### ` take `
391
424
392
425
``` purescript
0 commit comments