let test1fun x = [for i in 1..x-> i]
let test2fun x y= [for i in 1..x
do for i in 1..y-> i]
let singlesearcher i =
let rec searcher j agg =
if j > i
then agg
else searcher (j+1) (i::agg)
searcher 1 []
let doublesearcher i j =
let rec searcher k l agg =
if k > i
then searcher 1 (l+1) agg
else if l > j
then agg
else searcher (k+1) l ((k,l)::agg)
searcher 1 1 []
execution above C # time and 10000 for all inputs gives
list comprehension/singlesearcher-> negligable
cross product -> 320
list comprehension crossproduct -> 630
Why is the sublist view more than double the functional version?
Snark source
share