Hacker News new | ask | show | jobs
by Saavedro 4083 days ago
map takes a function and returns a function that takes a list and returns a list. It has a type like: (a->b) -> [a] -> [b] (I take a function from type a to type b and return a function from list of a to list of b)

define

double_list_elements = map (*2)

and

> double_list_elements [1, 2, 3, 4]

gives you [2, 4, 6, 8]