我想测试foldl vs foldr。从我所看到的情况来看,由于尾部递归优化,您应该在可能的情况下使用foldl over foldr。 这很有道理。但是,运行此测试后,我感到困惑: 文件夹(使用时间命令时需要0.057s): a::a -> [a] -> [a] a x = ([x] ++ ) main = putStrLn(show ( sum (foldr a [] [0.. 100000]))) foldl(使用time命令时需要0.089s): b::[b] -> b -> [b] b xs = ( ++ xs). (\y->[y]) main = putStrLn(show ( sum (foldl b [] [0.. …