# Haskell - Definition of higher-order functions (1) P90677

Statement html

This problem explores the definition of high-order functions on lists. Implement the followinf functions that work as the original Haskell functions without using the original function eachself (i.e., you cannot use foldl ti implement myFoldl but you can use it to implement myAll). Additionally. you can only use recursion to implement myFoldl, myFoldr, myIterate, myUntil and myZip.

1. myFoldl :: (a -> b -> a) -> a -> [b] -> a
2. myFoldr :: (a -> b -> b) -> b -> [a] -> b
3. myIterate :: (a -> a) -> a -> [a]
4. myUntil :: (a -> Bool) -> (a -> a) -> a -> a
5. myMap :: (a -> b) -> [a] -> [b]
6. myFilter :: (a -> Bool) -> [a] -> [a]
7. myAll :: (a -> Bool) -> [a] -> Bool
8. myAny :: (a -> Bool) -> [a] -> Bool
9. myZip :: [a] -> [b] -> [(a, b)]
10. myZipWith :: (a -> b -> c) -> [a] -> [b] -> [c]

Scoring

Each function scores 10 points.

Public test cases
• Input

```myFoldl (+) 1 [1..5]
myFoldr (+) 1 [1..5]
take 10 \$ myIterate (*2) 1
myUntil (>100) (*2) 1
myMap ("la "++) ["joana", "mireia"]
myFilter odd [1..10]
myAll odd [1,3,5,3,1]
myAny odd [2,4,6,8,10]
myZip [1..4] [1..3]
myZipWith (+) [1..4] [1..3]
```

Output

```16
16
[1,2,4,8,16,32,64,128,256,512]
128
["la joana","la mireia"]
[1,3,5,7,9]
True
False
[(1,1),(2,2),(3,3)]
[2,4,6]
```
• Information
Author
Albert Rubio / Jordi Petit
Language
English
Translator
Jordi Petit
Original language
Catalan
Other languages
Catalan
Official solutions