News for hackers. Stuff that matters.
Re:Teaching Haskell to a 10 year old: Day 1 by Saavedro on Wednesday April 08, 2015 @09:48PM (#9345384)
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]

There are no comments on this comment yet.