Illustration example
Let's say you have a list of lists:
let list = [ [1; 2]; [3; 4]; [5; 6] ]
And the conversion function:
let trans = fun x -> [for i in x -> i*10]
List.map trans list will produce:
[[10; 20]; [30; 40]; [50; 60]]
While
List.collect trans list will produce:
[10; 20; 30; 40; 50; 60]
List.collect apply the conversion function and the result will be Concatenate , and List.map apply only the conversion function.
polkduran
source share