added my
parent
725251dc57
commit
18c7245b16
|
@ -5,15 +5,15 @@ Implementiere die Funktion `map` rekursiv. Die Funktion nimmt eine Funktion `f`
|
|||
|
||||
## Signatur
|
||||
```haskell
|
||||
map :: (a -> b) -> [a] -> [b]
|
||||
myMap :: (a -> b) -> [a] -> [b]
|
||||
```
|
||||
|
||||
## Beispiel Testfäle
|
||||
```haskell
|
||||
map (*2) [1, 2, 3] -- [2, 4, 6]
|
||||
map show [1, 2, 3] -- ["1", "2", "3"]
|
||||
map (const "a") [1, 2, 3] -- ["a", "a", "a"]
|
||||
map (+1) [] -- []
|
||||
myMap (*2) [1, 2, 3] -- [2, 4, 6]
|
||||
myMap show [1, 2, 3] -- ["1", "2", "3"]
|
||||
myMap (const "a") [1, 2, 3] -- ["a", "a", "a"]
|
||||
myMap (+1) [] -- []
|
||||
```
|
||||
|
||||
## Anforderungen
|
||||
|
|
|
@ -5,16 +5,16 @@ Implementiere die Funktion `zip` rekursiv. Die Funktion nimmt zwei Listen und gi
|
|||
|
||||
## Signatur
|
||||
```haskell
|
||||
zip :: [a] -> [b] -> [(a, b)]
|
||||
myZip :: [a] -> [b] -> [(a, b)]
|
||||
```
|
||||
|
||||
## Beispiel Testfäle
|
||||
```
|
||||
zip [1,2,3] ['a', 'b', 'c'] -- [(1, 'a'), (2, 'b'), (3, 'c')]
|
||||
zip [1,2] ["eins", "zwei", "drei"] -- [(1, "eins"), (2, "zwei")]
|
||||
zip [True, False] [1,2,3] -- [(True,1), (False,2)]
|
||||
zip [] [1,2,3] -- []
|
||||
zip [1,2,3] [] -- []
|
||||
myZip [1,2,3] ['a', 'b', 'c'] -- [(1, 'a'), (2, 'b'), (3, 'c')]
|
||||
myZip [1,2] ["eins", "zwei", "drei"] -- [(1, "eins"), (2, "zwei")]
|
||||
myZip [True, False] [1,2,3] -- [(True,1), (False,2)]
|
||||
myZip [] [1,2,3] -- []
|
||||
myZip [1,2,3] [] -- []
|
||||
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue