This module exposes functions on list which are useful for the domain of data visualization. Most of these work with Lists of numbers.
Returns the minimum and maximum value in the given array using comparisons from values passed by the accessor function.
data : List { name : String, age : Int}
data =
[ {name = "John Smith", age = 32 }
, {name = "Mark Luther", age = 45 }
, {name = "Cory Jones", age = 26 }
]
extentWith .age data
--> Just ({name = "Cory Jones", age = 26 }
--> , {name = "Mark Luther", age = 45 })Methods for transforming list and for generating new lists.
Returns a list of approximately n + 1 uniformly-spaced, nicely-rounded values between a start and stop value (inclusive). Each value is a power of ten multiplied by 1, 2 or 5. Note that due to the limited precision of IEEE 754 floating point, the returned values may not be exact decimals.
Ticks are inclusive in the sense that they may include the specified start and stop values if (and only if) they are exact, nicely-rounded values consistent with the inferred step. More formally, each returned tick t satisfies start ≤ t and t ≤ stop.
ticks 1.9 6.4 10 --> [2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6]
ticks 1.9 6 5 --> [2, 3, 4, 5, 6]Returns the difference between adjacent tick values if the same arguments
were passed to ticks: a nicely-rounded value that is a power of ten multiplied
by 1, 2 or 5. Note that due to the limited precision of IEEE 754 floating point,
the returned value may not be exact decimals.
tickStep 1.9 6.4 10 --> 0.5
tickStep 1.9 6 5 --> 1Returns a List containing an arithmetic progression, similar to the Python built-in range. This method is often used to iterate over a sequence of uniformly-spaced numeric values, such as the indexes of an array or the ticks of a linear scale. (See also ticks for nicely-rounded values.)
Takes a start, stop and step argument. The stop value is exclusive; it is not
included in the result. If step is positive, the last element is the largest
start + i * step less than stop; if step is negative, the last element is
the smallest start + i * step greater than stop. If the returned list would
contain an infinite number of values, an empty range is returned.
The arguments are not required to be whole numbers; however, the results are more predictable if they are.
Differences from List.range from the standard library:
List.range is inclusive, meaning that the stop value will be included in the resultList.range only supports Int, whereas this supports any number typesList.range supports only increasing intervals (i.e. List.range 3 1 == [] vs. range 3 1 -1 == [3, 2]).List.range doesn't allow for specifying the step valueList.range is most likely faster
Returns the minimum and maximum value in the list.