Haskell — Usage of comprehension lists

In this problem you should implemet a series of functions using comprehension lists.

  1. Implement a function myMap :: (a -> b) -> [a] -> [b] that emulates map using comprehension lists.

  2. Implement a function myFilter :: (a -> Bool) -> [a] -> [a] that emulates filter using comprehension lists.

  3. Implement a function myZipWith :: (a -> b -> c) -> [a] -> [b] -> [c] that emulates zipWith using comprehension lists and zip.

  4. Implement a function thingify :: [Int] -> [Int] -> [(Int, Int)] that, given two lists of integers, returns the list that pairs the elements if the element of the second list divides the one in the first list.

  5. Implement a function factors :: Int -> [Int] that, given a non-null natural number, generates the ordered list with all its factors (non necessaryly primes).

Scoring

Each function scores 20 points.

Problem information

Author: Unknown
Translator: Jordi Petit

Generation: 2026-02-03T17:10:39.499Z

© Jutge.org, 2006–2026.
https://jutge.org