PRELUDE: simplify seqList

This commit is contained in:
hasufell 2014-10-12 16:09:17 +02:00
parent 7a73ea7a1d
commit d3a7c04398
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
1 changed files with 1 additions and 1 deletions

View File

@ -65,7 +65,7 @@ first f (x,y) = (f x, y)
-- |Sequentialize a list, such as:
-- [1, 2, 3, 4, 5] -> [[1],[1,2],[1,2,3],[1,2,3,4],[1,2,3,4,5]]
seqList :: [a] -> [[a]]
seqList = reverse . takeWhile (not . null) . iterate init
seqList = tail. inits
-- |Duplicate the last element of a list and append it.