rsagl-math-0.6.0.1: The RogueStar Animation and Graphics Library: Mathematics

RSAGL.Math.ListUtils

Synopsis

Documentation

doubles :: [a] -> [(a, a)]Source

Transforms a list to a list of adjacent elements.

doubles [1,2,3,4,5] = [(1,2),(2,3),(3,4),(4,5)]

loopedDoubles :: [a] -> [(a, a)]Source

loopedDoubles transforms a list to a list of adjacent elements, looping back to the beginning of the list.

loopedRSdoubles [1,2,3,4,5] = [(1,2),(2,3),(3,4),(4,5),(5,1)]

consecutives :: Int -> [a] -> [[a]]Source

Answers a list containing every sequence of n consecutive elements in the parameter.

consecutives 3 [1,2,3,4] = [[1,2,3],[2,3,4]]

loopedConsecutives :: Int -> [a] -> [[a]]Source

Answers a list containing every sequence of n consecutive elements in the parameter, looping back to the beginning of the list.

consecutives 3 [1,2,3,4] = [[1,2,3],[2,3,4],[3,4,1],[4,1,2]]

zeroToOne :: Integer -> [RSdouble]Source

Creates a list of numbers from 0.0 to 1.0, using n steps. This can't be done with the enum-from-to method, due to roundoff errors.