Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/tests/conformance98/slow/fast.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


module Main where

type Vector a = [a]

produce :: Int -> Double -> Vector Double
produce = replicate 

scprod :: Int -> Vector Double -> Vector Double -> Double
scprod n a b = foldr (+) start [a!!x * b!!x | x <- [2..n]]
               where start = a!!1 * b!!1

main = print (show (scprod n a a))
       where a = produce n 1.0
             n = 1000000


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.