# RRBList

- Package
- purescript-rrb-list
- Repository
- funkia/purescript-rrb-list

### #fromFoldable Source

`fromFoldable :: forall f. Foldable f => f ~> List`

Convert a `Foldable`

structure into an `List`

.

Running time: `O(n)`

.

### #toUnfoldable Source

`toUnfoldable :: forall f. Unfoldable f => List ~> f`

Convert a `List`

into an `Unfoldable`

structure.

### #(..) Source

Operator alias for RRBList.range *(non-associative / precedence 8)*

An infix synonym for `range`

.

### #some Source

`some :: forall a f. Alternative f => Lazy (f (List a)) => f a -> f (List a)`

Attempt a computation multiple times, requiring at least one success.

The `Lazy`

constraint is used to generate the result lazily, to ensure
termination.

### #many Source

`many :: forall a f. Alternative f => Lazy (f (List a)) => f a -> f (List a)`

Attempt a computation multiple times, returning as many successful results as possible (possibly zero).

The `Lazy`

constraint is used to generate the result lazily, to ensure
termination.

### #(:) Source

Operator alias for RRBList.cons *(right-associative / precedence 6)*

An infix alias for `cons`

.

Note, the running time of this function is `O(log(n))`

, practically constant.

### #(!!) Source

Operator alias for RRBList.index *(left-associative / precedence 8)*

An infix version of `index`

.

### #elemLastIndex Source

`elemLastIndex :: forall a. Eq a => a -> List a -> Maybe Int`

Find the index of the last element equal to the specified element.

### #findLastIndex Source

`findLastIndex :: forall a. (a -> Boolean) -> List a -> Maybe Int`

Find the last index for which a predicate holds.

### #modifyAtIndices Source

`modifyAtIndices :: forall a t. Foldable t => t Int -> (a -> a) -> List a -> List a`

Apply a function to the element at the specified indices, creating a new array. Out-of-bounds indices will have no effect.

Running time: `O(m * log(n))`

, where `m`

is the number of indices
and `n`

is the length of the list.

### #filterA Source

`filterA :: forall f a. Applicative f => (a -> f Boolean) -> List a -> f (List a)`

Filter where the predicate returns a `Boolean`

in some `Applicative`

.

### #mapWithIndex Source

`mapWithIndex :: forall b a. (Int -> a -> b) -> List a -> List b`

Apply a function to each element in a list, supplying a generated zero-based index integer along with the element, creating a list with the new elements.

### #difference Source

`difference :: forall a. Eq a => List a -> List a -> List a`

Delete the first occurrence of each element in the second list from the first list, creating a new list.

Running time: `O(n*m)`

, where n is the length of the first list, and m is
the length of the second.

### #intersectBy Source

`intersectBy :: forall a. (a -> a -> Boolean) -> List a -> List a -> List a`

Calculate the intersection of two lists, using the specified equivalence relation to compare elements, creating a new list. Note that duplicates in the first list are preserved while duplicates in the second list are removed.

Running time: `O(n*m)`

.

### #zipWithA Source

`zipWithA :: forall c b a m. Applicative m => (a -> b -> m c) -> List a -> List b -> m (List c)`

A generalization of `zipWith`

which accumulates results in some
`Applicative`

functor.

Running time: `O(n)`

.

### #unsafeIndex Source

`unsafeIndex :: forall a. Partial => List a -> Int -> a`

Find the element of a list at the specified index.

Using `unsafeIndex`

with an out-of-range index will not immediately raise a runtime error.
Instead, the result will be undefined. Most attempts to subsequently use the result will
cause a runtime error, of course, but this is not guaranteed, and is dependent on the backend;
some programs will continue to run as if nothing is wrong. For example, in the JavaScript backend,
the expression `unsafePartial (unsafeIndex (singleton true) 1)`

has type `Boolean`

;
since this expression evaluates to `undefined`

, attempting to use it in an `if`

statement will cause
the else branch to be taken.

Running time: `O(log(n))`

, effectively constant.

## Re-exports from **Data.**Foldable

### #intercalate Source

`intercalate :: forall m f. Foldable f => Monoid m => m -> f m -> m`

Fold a data structure, accumulating values in some `Monoid`

,
combining adjacent elements using the specified separator.

### #any Source

`any :: forall f b a. Foldable f => HeytingAlgebra b => (a -> b) -> f a -> b`

`any f`

is the same as `or <<< map f`

; map a function over the structure,
and then get the disjunction of the results.

### #all Source

`all :: forall f b a. Foldable f => HeytingAlgebra b => (a -> b) -> f a -> b`

`all f`

is the same as `and <<< map f`

; map a function over the structure,
and then get the conjunction of the results.

## Re-exports from **Data.**Traversable

### #scanr Source

`scanr :: forall f b a. Traversable f => (a -> b -> b) -> b -> f a -> f b`

Fold a data structure from the right, keeping all intermediate results
instead of only the final result. Note that the initial value does not
appear in the result (unlike Haskell's `Prelude.scanr`

).

```
scanr (+) 0 [1,2,3] = [1,3,6]
scanr (flip (-)) 10 [1,2,3] = [4,5,7]
```

### #scanl Source

`scanl :: forall f b a. Traversable f => (b -> a -> b) -> b -> f a -> f b`

Fold a data structure from the left, keeping all intermediate results
instead of only the final result. Note that the initial value does not
appear in the result (unlike Haskell's `Prelude.scanl`

).

```
scanl (+) 0 [1,2,3] = [1,3,6]
scanl (-) 10 [1,2,3] = [9,7,4]
```

## Re-exports from **RRBList.**Types

- Modules
- RRBList
- RRBList.
Types