S SmartDocs
Serie: haskell haskell 15 líneas · Actualizado 2026-02-03

exercise_2.hs

haskell/Week_6_Lab/exercise_2.hs

-- Part of Exercise 2
-- Define a custom myMap function
myMap :: (a -> b) -> [a] -> [b]
myMap _ [] = []
myMap f (x:xs) = (f x) : myMap f xs

-- Re-define the functions using myMap
incAll :: [Integer] -> [Integer]
incAll = myMap (+1)

negateAll :: [Bool] -> [Bool]
negateAll = myMap not

isLeast100All :: [Integer] -> [Bool]
isLeast100All = myMap (>= 100)

Artículos relacionados