[project @ 1997-03-14 07:52:06 by simonpj]
[ghc-hetmet.git] / ghc / lib / tests / Array / arr010 / Main.hs
1 --
2 -- Array - accumulated arrays
3 -- 
4 --
5 module Main(main) where
6
7 import Array
8 import Ix
9
10 hist :: (Ix a, Num b) => (a,a) -> [a] -> Array a b
11 hist bnds is = accumArray (+) 0 bnds [(i,1) | i <- is , inRange bnds i]
12
13 main = 
14  let 
15   a1 = hist (0,10) (concat $ take 2 $ repeat [1..20])
16  in
17  print a1
18
19