In vector library there's this useful function:
imap :: (Int -> a -> b) -> Vector a -> Vector b
And in Data.Map there's this similar function:
mapWithKey :: (k -> a -> b) -> Map k a -> Map k b
I'm looking for something similar in the array and accelerate libraries, i.e.
On arrays in Data.Array.IArray:
imap :: (IArray a e, IArray a e', Ix i) => (i -> e -> e') -> a i e -> a i e'
And on Accelerate arrays:
imap :: (Shape ix, Elt a, Elt b) => (Exp ix -> Exp a -> Exp b) -> Acc
(Array ix a) -> Acc (Array ix b)
Is anyone aware of such map implementations for arrays in the array
and accelerate libraries, that provide your mapped function not only
the element at a position, but also the index at that position?
Thanks,
--
Rob
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe