Skip to content
Brian Marick edited this page Apr 27, 2017 · 1 revision

Problem 1

> add5 x = sum x 5
<function> : number -> number

Problem 2

> List.map add5 [1, 2, 3]
[6,7,8] : List number

Problem 3

> doTo123 function = List.map function [1, 2, 3]
<function> : (number -> b) -> List b

It's pretty common in static FP code to name a function parameter f, like this:

> doTo123 f = List.map f [1, 2, 3]
<function> : (number -> b) -> List b

I'm not normally a fan of single-letter names, but this is so common that it quickly becomes instantly recognizable.