Haskell — Usage of higher-order functions (1)

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

  1. Implement a function eql :: [Int] -> [Int] -> Bool that tells wether two lists of integers are equal.

  2. Implement a function prod :: [Int] -> Int that returns the product of a list of integers.

  3. Implement a function prodOfEvens :: [Int] -> Int that returns the product of all even numbers of a list of integers.

  4. Implement a function powersOf2 :: [Int] that generates the list of all the powers of 2.

  5. Implement a function scalarProduct :: [Float] -> [Float] -> Float that returns the dot product of two lists of float numbers with the same size.

Scoring

Each function scores 20 points.

Problem information

Author: Unknown
Translator: Jordi Petit

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

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