Chadtech / elm-vector / Vector60

A vector of length 60

Vector60


type alias Vector60 a =
Internal.Vector60 a

A vector that contains exactly 60 elements

Creation

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

Turn a List a into a Vector60 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 -> Vector60 a

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

from60 : 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 -> Vector60 a

Make a Vector60 a from 60 elements

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

Turn a List a into a Vector60 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 : (Basics.Int -> a) -> Vector60 a

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

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

Make a Vector60 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

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

get : Index -> Vector60 a -> a

Get the item at that Index in a Vector60 a

set : Index -> a -> Vector60 a -> Vector60 a

Set the item at a specific index in a Vector60 a

indices : Vector60 Index

A list of all the indices, from 0 to 59

indexToInt : Index -> Basics.Int

Turn the Index into an Int

intToIndex : Basics.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 Vector60 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)

previousIndex : Index -> Maybe Index

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) -> Vector60 a -> Vector60 b

Apply a function to every element in a Vector60 a.

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

Transform just one particular item at a particular Index

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

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

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

Reduce a Vector60 a from the right.

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

Reduce a Vector60 a from the left.

map2 : (a -> b -> c) -> Vector60 a -> Vector60 b -> Vector60 c

map3 : (a -> b -> c -> d) -> Vector60 a -> Vector60 b -> Vector60 c -> Vector60 d

map4 : (a -> b -> c -> d -> e) -> Vector60 a -> Vector60 b -> Vector60 c -> Vector60 d -> Vector60 e

map5 : (a -> b -> c -> d -> e -> f) -> Vector60 a -> Vector60 b -> Vector60 c -> Vector60 d -> Vector60 e -> Vector60 f

Lists

toList : Vector60 a -> List a

Convert a Vector60 a into a List a of length 60

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

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

Methods

pop : Vector60 a -> ( Vector59.Internal.Vector59 a, a )

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

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

uncons : Vector60 a -> ( a, Vector59.Internal.Vector59 a )

Split a Vector60 a into its first element and the rest

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

Util

length : Basics.Int

The length of this vector type, which is 60

reverse : Vector60 a -> Vector60 a

Reverse the order of the items in a Vector60 a

member : a -> Vector60 a -> Basics.Bool

See if a Vector60 a contains a value

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

Break a List a down into groups of Vector60 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 ])