Browse Source

Add cycler to ch04/02ex10; rename anyp to anyr in ch04/02ex10

master
Piotr Orzechowski 4 years ago
parent
commit
e84f75b7b1
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      ch04/02ex10.hs

+ 6
- 2
ch04/02ex10.hs View File

@@ -9,8 +9,12 @@ anyl :: (a -> Bool) -> [a] -> Bool
anyl p = foldl' (\acc x -> acc || p x) False


anyp :: (a -> Bool) -> [a] -> Bool
anyp p = foldr (\x acc -> acc || p x) False
anyr :: (a -> Bool) -> [a] -> Bool
anyr p = foldr (\x acc -> acc || p x) False


cycler :: [a] -> [a]
cycler = foldr (\x acc -> x ++ acc) [] . repeat


wordsl :: String -> [String]

Loading…
Cancel
Save