2 ms·
resultQ :: W -> (W,W) resultQ n = foldAllS max (0,0) $ runIdentity $ R.computeUnboxedP vec where fun (Z :. i) = len &&& id $ fromIntegral i ve
by lelf 13y ago
resultQ :: W -> (W,W)
resultQ n = foldAllS max (0,0) $ runIdentity $ R.computeUnboxedP vec
where
fun (Z :. i) = len &&& id $ fromIntegral i
vec = R.fromFunction (Z :. fromIntegral n) fun :: Array D DIM1 (W,W)
Not as straight forward, but http://lelf.lu/files/fast-num-haskell-bench-N2.html http://lelf.lu/files/fast-num-haskell-bench-N2.html (now you now number of cores on my macbook I guess).
Not bad for 3 lines of code?