我是 Haskell 的新手。我正在研究二进制搜索算法的基准(标准)。我不断收到错误:'nf' 应用于太少的参数我做错了什么。
谢谢
binSear array serNum lowInx highInx
| highInx < lowInx = -1
| array!!sred > serNum = binSear array serNum lowInx (mid-1)
| array!!sred < serNum = binSear array serNum (mid+1) highInx
| otherwise = mid
where
mid = lowInx + ((highInx - lowInx) `div` 2)
main = do
let arr = [1..10000000]
defaultMain [
bench "1" $ nf (binSear arr 54527 0 9999999)
]