View Source Adept.List (adept v0.1.0)

Link to this section Summary

Functions

Randomize the order of a list.

Splits the list into n new lists organized into columns

Generate a list of arbirary length randomly sampled from a source list.

Link to this section Functions

@spec randomize(list :: list()) :: list()

Randomize the order of a list.

Link to this function

split_columns(items, count)

View Source
@spec split_columns(items :: list(), count :: pos_integer()) :: list()

Splits the list into n new lists organized into columns

example

Example

iex> Adept.Map.split_columns( [1,2,3,4,5,6,7,8,9], 3 )
[[1,4,7], [2,5,8], [3,6,9]]
Link to this function

take_random(source, len)

View Source
@spec take_random(list :: list(), length :: pos_integer()) :: list()

Generate a list of arbirary length randomly sampled from a source list.

Items in the source list can be repeated in the final list, since they are randomly sampled.

Unlike Enum.take, take_random can generate a new list that is longer than the source list.