- doubles :: [a] -> [(a, a)]
- loopedDoubles :: [a] -> [(a, a)]
- consecutives :: Int -> [a] -> [[a]]
- loopedConsecutives :: Int -> [a] -> [[a]]
- zeroToOne :: Integer -> [RSdouble]
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]]