Keep the order if FirstToLast, reverse if LastToFirst.
[ 1, 2, 3 ] |> List.order LastToFirst
--> [ 3, 2, 1 ]
[ 1, 2, 3 ] |> List.order FirstToLast
--> [ 1, 2, 3 ]Split the Array into equal-sized chunks. The elements left over on one side are in less.
[ 1, 2, 3, 4, 5, 6, 7 ]
|> List.group 3 FirstToLast
--> { groups = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
--> , less = Array.fromList [ 7 ]
--> }
[ 1, 2, 3, 4, 5, 6, 7 ]
|> List.group 3 LastToFirst
--> { less = [ 1 ]
--> , groups = [ [ 2, 3, 4 ], [ 5, 6, 7 ] ]
--> }Only use a number of elements from one side.
[ 1, 2, 3, 4 ]
|> List.takeFrom FirstToLast 2
--> [ 1, 2 ]
[ 1, 2, 3, 4 ]
|> List.takeFrom LastToFirst 2
--> [ 3, 4 ]Named this way to avoid name clashes with List.take when importing List.LinearDirection as List.
Remove a number of elements from one side.
tail =
List.dropFrom FirstToLast 1
removeLast =
List.dropFrom LastToFirst 1Named this way to avoid name clashes with List.drop when importing List.LinearDirection as List.
Reduce a
Listin a direction.