Little partial application challenge in Haskell

antonrich

Anton

Posted on November 13, 2018

Little partial application challenge in Haskell

Correct a function that maps a list of negative numbers.

Input: [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0]

Output: [-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1]

A function that I wrote but that results in a mistake.

map (-1) [-10..0]

This can be solved using lambda

map (\x -> x - 1) [-10..0]

The challenge is to solve it with partial application.

💖 💪 🙅 🚩
antonrich
Anton

Posted on November 13, 2018

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related