Commit before generalising picture transformation to alternative

This commit is contained in:
jgk
2021-07-21 14:38:57 +02:00
parent e5bee30f5b
commit 0aa437d035
6 changed files with 25 additions and 20 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ takeOneMore (xs,ys) = do
return (w:xs, zs ++ ws)
takeNMore :: RandomGen g => Int -> ([a],[a]) -> State g ([a],[a])
takeNMore n p = foldr (const (>>= takeOneMore)) (return p) [1..n]
takeNMore n p = foldl' (flip $ const (>>= takeOneMore)) (return p) [1..n]
takeN :: RandomGen g => Int -> [a] -> State g [a]
takeN 0 _ = return []