I started my journey into functional programming a couple of weeks ago and started trolling the LISP groups to help revive some long dormant grey cells. I stumbled across this challenge early this week and was thrilled to see all the multi-language replies, especially Herman's, since F# is the FP language that I'm starting with. I'm glad to know that there's at least one familiar person that I can turn to
Here's my F# one liner submission. It's the same as Herman's; it just uses currying and forward piping to clean things up a bit.
[[0..9];[10..19];[20..29]] |> List.map (List.map (fun n -> n*3));;
Which returns
[[0; 3; 6; 9; 12; 15; 18; 21; 24; 27];
[30; 33; 36; 39; 42; 45; 48; 51; 54; 57];
[60; 63; 66; 69; 72; 75; 78; 81; 84; 87]]
Although in real code I'd name it and allow any function to be passed in.
let nestedMap f inputList =
inputList |> List.map (List.map f)
Anyway, great post, great replies. I sure hope to see more.