Open radrow opened 4 years ago
For reference, this is what you can write at the moment:
function map(f : ('a) => 'b) : list('a) => list('b) = (l) => switch(l)
[] => []
h::t => f(h)::map(f)(t)
function map_deep(f : ('a) => 'b) : list(list('a)) => list(list('b)) = (l) =>
map(map(f))(l)
or
function
map : ('a => 'b) => list('a) => list('b)
map(f) = (l) => switch(l)
[] => []
h::t => f(h)::map(f)(t)
function
map_deep : ('a => 'b) => list(list('a)) => list(list('b))
map_deep(f) = (l) => map(map(f))(l)
Sometimes curried functions are more useful than >1 arity ones, because they play very naturally with partial application. Example of syntax/usage: