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

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


module Main where

import Array

produce :: Int -> Double -> Array Int Double
produce n x = array (1,n) [(i,x) | i <- [1..n]]

scprod :: Array Int Double -> Array Int Double -> Double
scprod a b =
        case (bounds a, bounds b) of
          ((1,i), (1,j)) ->
                foldl (+) start [a!(x) * b!(x) | x <- [2..i]]
                where start = a!(1) * b!(1)

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


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.