List is a package for dealing with iterators.
List
List data structure represents the pair of current and rest items.
There are many functions to use Lists, so they are categorized here.
These functions generate a new list from some data:
build
digits
empty
iota
range
repeat
repeatWith
replicate
singleton
singletonWith
successors
unfoldR
These function convert from the data structure into a list:
fromArray
Array
fromIterable
Iterable
fromOption
Option
fromReduce
Reduce
fromString
String
These function convert from a list into the data structure:
toArray
toIterator
Iterator
toString
string
There are some functions to query the item in a list:
atMay
elemIndex
elemIndices
findIndex
findIndices
head
isNull
last
length
tail
unCons
These functions operate a list of list:
cartesianProduct
choices
concat
concatMap
diagonal
diagonals
enumerate
group
groupBy
intercalate
interleave
interleaveTwoWay
intersperse
permutations
subsequences
subsequencesExceptEmpty
transpose
tupleCartesian
zip
zip3
zip4
zipWith
These functions modify elements of list:
apply
applyCartesian
drop
dropWhile
dropWhileEnd
filter
flatMap
init
map
mapOption
reverse
stripPrefix
take
takeWhile
These functions add elements to list:
appendToHead
appendToTail
plus
These functions decompose list into other ones:
span
spanNot
splitAt
unzip
These functions fold values of list:
either
foldL
foldL1
foldR
foldR1
scanL
Generated using TypeDoc
Listis a package for dealing with iterators.Features
Listdata structure represents the pair of current and rest items.There are many functions to use
Lists, so they are categorized here.Generators
These functions generate a new list from some data:
buildcreates a list from an appending function.digitsmakes a number a list of digits.emptycreates a list with no items.iotais an infinite list of integers.rangecreates a list of numbers for the right half-open interval.repeatcreates an infinite list that repeats a value.repeatWithcreates an infinite list that repeats to call a function.replicatecreates a list that repeats a value specified times.singletoncreates a list with the item.singletonWithcreates a list with item from the function.successorscreates an infinite list with mutating by the function.unfoldRcreates a list with the builder function.These function convert from the data structure into a list:
fromArrayconverts from anArray.fromIterableconverts from anIterable.fromOptionconverts from anOption.fromReduceconverts from a data structure that is an instance ofReduce.fromStringconverts from aString.These function convert from a list into the data structure:
toArrayconverts into an eagerArrayof items.toIteratorconverts a lazyIterator.toStringconverts a list ofstrings by join method.Queries
There are some functions to query the item in a list:
atMaygets the n-th item of list.elemIndexfinds the index of matching element.elemIndicesfinds the indices of matching element.findIndexfinds the index of element satisfies the predicate.findIndicesfinds the indices of element satisfies the predicate.headgets the first item of list.isNullreturns whether the list is empty.lastgets the last item of list.lengthfinds the length of list.tailgets the items of list except the first.unConsdecomposes the option having head item and rest items.Manipulators
These functions operate a list of list:
cartesianProductworks with combinations from two lists.choicescreates unsorted combinations from two lists.concatflattens a list of list.concatMaptransforms a list into the list of list and flattens it.diagonalextracts the sequential diagonal from a two-dimensional list.diagonalsleaves the sequential diagonal of a two-dimensional list.enumerateappends the indices.groupunifies the equal adjacent elements.groupByunifies the adjacent elements which satisfies the predicate.intercalateinserts items among each list of list.interleavetransposes and flattens a two-dimensional list.interleaveTwoWaytransposes and flattens two lists.interspersejoins lists with a separator.permutationscreates a list of permutations.subsequencescreates a list of subsequences.subsequencesExceptEmptycreates a list of subsequences except the empty list.transposetransposes a two-dimensional list.tupleCartesiancomposes two lists into a list of tuple of combinations.zipcomposes two lists as a list of tuple.zip3composes three lists as a list of tuple.zip4composes four lists as a list of tuple.zipWithcomposes two lists as a list of item made by the function.These functions modify elements of list:
applyexhausts items of the list with applying each function of the list.applyCartesianapplies the parameters to the functions with all combinations.dropignores prefix items by the count.dropWhileignores prefix items which satisfies the predicate.dropWhileEndignores suffix items which satisfies the predicate.filterpasses only if the item satisfies the predicate.flatMapmaps items of the list by the function and flattens it.initremoves the last item of the list.maptransforms items of the list by the function.mapOptiontransforms items of the list, or removes if the function returned a none.reversereverses the list items.stripPrefixstrips the matching prefix.taketakes prefix items by the count.takeWhiletakes prefix items while the item satisfies the predicate.These functions add elements to list:
appendToHeadadds the item to the head of list.appendToTailadds the item to the tail of list.plusconcatenates two lists.These functions decompose list into other ones:
spansplits the list with the predicate.spanNotsplits the list with the negative predicate.splitAtsplits the list at the position.unzipdecomposes the list of tuples into a tuple of lists.These functions fold values of list:
eithertransforms the list either the head value exists or not.foldLfolds values of the list from the left-side with an initial value.foldL1folds values of the list from the left-side.foldRfolds values of the list from the right-side with an initial value.foldR1folds values of the list from the right-side.scanLfolds values of the list with leaving breadcrumbs.