Haskell — Usage of higer-order functions (2)

Implement the following functions using higher-order functions (and other predefined functions) of Haskell without using recursion.

  1. Implement a function flatten :: [[Int]] -> [Int] that flattens a list of lists of integers in a list of integers.

  2. Implement a function myLength :: String -> Int that returns the length of a string.

  3. Implement a function myReverse :: [Int] -> [Int] that reverses a list of integers.

  4. Implement a function countIn :: [[Int]] -> Int -> [Int] that, given a list of sublists \ell and an element xx, returns the list that tells who many times xx appears in each sublist of \ell.

  5. Implement a function firstWord :: String -> String that, given a string with blanks and alphabetic characters, returns its first word.

Scoring

Each function scores 20 points.

Problem information

Author: Unknown
Translator: Jordi Petit

Generation: 2026-02-03T17:11:10.229Z

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