Make the evaluator's review weights configurable.
[match/match.git] / program / ArrayStuff.hs
index abf14c7..ceb7516 100644 (file)
@@ -4,6 +4,8 @@ import Data.Array.IArray
 
 funcArray lohi f = listArray lohi $ map f $ range lohi
 
+constArray lohi v = listArray lohi $ repeat v
+
 transposeArray arr =
        let swap (x, y) = (y, x) in
        let (lo, hi) = bounds arr in
@@ -16,3 +18,6 @@ array2DtoListOfLists arr =
 -- Use instead of amap when the array implementation needs to change.
 -- E.g., mapping an unboxed array to an array whose elements must be boxed.
 amap2 f arr = funcArray (bounds arr) (\i -> f (arr ! i))
+
+-- Like amap2 but the mapping function is also passed the index.
+aixmap f arr = funcArray (bounds arr) (\i -> f i (arr ! i))