想写一个求均值的函数。
写成
写成
mean x = sum(x) / length(x)总是类型不对,double/int除不了。
没办法,还没有看到怎么转换类型,只有重写了一个length。
mean x = sum(x) / len(x)
where len [] = 0.0
len x = 1.0 + len (tail x)
mean x = sum(x) / length(x)总是类型不对,double/int除不了。
没办法,还没有看到怎么转换类型,只有重写了一个length。
mean x = sum(x) / len(x)
where len [] = 0.0
len x = 1.0 + len (tail x)

被折叠的 条评论
为什么被折叠?