Browse Source

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

Piotr Orzechowski 3 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
9 9
 anyl p = foldl' (\acc x -> acc || p x) False
10 10
 
11 11
 
12
-anyp :: (a -> Bool) -> [a] -> Bool
13
-anyp p = foldr (\x acc -> acc || p x) False
12
+anyr :: (a -> Bool) -> [a] -> Bool
13
+anyr p = foldr (\x acc -> acc || p x) False
14
+
15
+
16
+cycler :: [a] -> [a]
17
+cycler = foldr (\x acc -> x ++ acc) [] . repeat
14 18
 
15 19
 
16 20
 wordsl :: String -> [String]

Loading…
Cancel
Save