Chadtech/elm-vector/2.0.0

NOTE: the latest version is 3.0.2

Vector62

A vector of length 62

Vector62

type alias Vector62 a =
Vector62 a

A vector that contains exactly 62 elements

Creation

fromList : List a -> Maybe ( List a, Vector62 a )

Turn a List a into a Vector62 a. If there are not enough items in the List a, then this function returns Nothing. The extra items in the input list, if there are any, is returned as the first element in the output tuple.

Vector3.fromList []
--> Nothing


Vector3.fromList [ 1 ]
--> Nothing


Vector3.fromList [ 5, 6, 7, 8 ]
--> Just ([ 8 ], Vector3.from3 5 6 7)
repeat : a -> Vector62 a

Make a Vector62 a filled with just one item repeated over and over again.

a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> a
-> Vector62 a

Make a Vector62 a from 62 elements

fromListWithDefault : a -> List a -> ( List a, Vector62 a )

Turn a List a into a Vector62 a. If there are not enough items in the List a, then fill in the remaining spots with a default value. The extra items in the input list, if there are any, is returned as the first element in the output tuple.

Vector3.fromListWithDefault 1 []
--> ([] ,Vector3.from3 1 1 1)


Vector3.fromListWithDefault 2 [ 1 ]
--> ([], Vector3.from3 1 2 2)


Vector3.fromListWithDefault 2 [ 5, 6, 7, 8 ]
--> ([ 8 ], Vector3.from3 5 6 7)
initializeFromInt : (Int -> a) -> Vector62 a

Make a Vector62 a using a function that takes an Int, representing the index

initializeFromIndex : (Index -> a) -> Vector62 a

Make a Vector62 a using a function that takes an Index

Index

type Index
= Index0
| Index1
| Index2
| Index3
| Index4
| Index5
| Index6
| Index7
| Index8
| Index9
| Index10
| Index11
| Index12
| Index13
| Index14
| Index15
| Index16
| Index17
| Index18
| Index19
| Index20
| Index21
| Index22
| Index23
| Index24
| Index25
| Index26
| Index27
| Index28
| Index29
| Index30
| Index31
| Index32
| Index33
| Index34
| Index35
| Index36
| Index37
| Index38
| Index39
| Index40
| Index41
| Index42
| Index43
| Index44
| Index45
| Index46
| Index47
| Index48
| Index49
| Index50
| Index51
| Index52
| Index53
| Index54
| Index55
| Index56
| Index57
| Index58
| Index59
| Index60
| Index61

All the indices to a Vector62 a. There are exactly 62 of them. Its kind of like an Int except there is a finite amount of them.

get : Index -> Vector62 a -> a

Get the item at that Index in a Vector62 a

set : Index -> a -> Vector62 a -> Vector62 a

Set the item at a specific index in a Vector62 a

indexToInt : Index -> Int

Turn the Index into an Int

intToIndex : Int -> Maybe Index

Try and turn an Int into an Index, returning Nothing if the Int is above the maximum index, or below the zero index, of this Vector62 a

    Vector5.intToIndex 4
    --> Just Vector5.Index4


    Vector3.intToIndex 4
    --> Nothing 
nextIndex : Index -> Maybe Index

Given an index, get the next one. Unless its the last index in which case there is no next index (Nothing)

Given an index, get the previous one. Unless its the 0 index in which case there is no previous index (Nothing)

Transform

map : (a -> b) -> Vector62 a -> Vector62 b

Apply a function to every element in a Vector62 a.

mapItem : Index -> (a -> a) -> Vector62 a -> Vector62 a

Transform just one particular item at a particular Index

indexedMap : (Index -> a -> b) -> Vector62 a -> Vector62 b

Apply a function on every element with its index as first argument

foldr : (a -> b -> b) -> b -> Vector62 a -> b

Reduce a Vector62 a from the right.

foldl : (a -> b -> b) -> b -> Vector62 a -> b

Reduce a Vector62 a from the left.

map2 : (a -> b -> c) -> Vector62 a -> Vector62 b -> Vector62 c
map3 : (a -> b -> c -> d) -> Vector62 a -> Vector62 b -> Vector62 c -> Vector62 d
(a -> b -> c -> d -> e)
-> Vector62 a
-> Vector62 b
-> Vector62 c
-> Vector62 d
-> Vector62 e
(a -> b -> c -> d -> e -> f)
-> Vector62 a
-> Vector62 b
-> Vector62 c
-> Vector62 d
-> Vector62 e
-> Vector62 f

Lists

toList : Vector62 a -> List a

Convert a Vector62 a into a List a of length 62

toIndexedList : Vector62 a -> List ( Index, a )

Turn a Vector62 a elm into a list, where each element is paired with its Index

Methods

pop : Vector62 a -> ( Vector61 a, a )

Separate a Vector62 a into its last element and everything else.

Vector4.pop (Vector4.from4 0 1 2 3)
--> (Vector3.from3 0 1 2, 3) 
uncons : Vector62 a -> ( a, Vector61 a )

Split a Vector62 a into its first element and the rest

Vector4.uncons (Vector4.from4 0 1 2 3)
--> (0, Vector3.from3 1 2 3) 

Util

length : Int

The length of this vector type, which is 62

reverse : Vector62 a -> Vector62 a

Reverse the order of the items in a Vector62 a

member : a -> Vector62 a -> Bool

See if a Vector62 a contains a value

group : List a -> ( List a, List (Vector62 a) )

Break a List a down into groups of Vector62 a. The output is a tuple, where the left side is a list of the remainder.

Vector3.group [ 1, 2, 3 ]
--> ([] , [ Vector3.from3 1 2 3 ])


Vector3.group [ 1, 2, 3, 4 ]
--> ([ 4 ] , [ Vector3.from3 1 2 3 ])


Vector3.group [ 1, 2, 3, 4, 5 ]
--> ([ 4, 5 ] , [ Vector3.from3 1 2 3 ])


Vector3.group [ 1, 2, 3, 4, 5, 6 ]
--> ([] , [ Vector3.from3 1 2 3, Vector3.from3 4 5 6 ])