Add new indexing functions

This commit is contained in:
Kiana Sheibani 2022-08-29 13:55:55 -04:00
parent 9ece7e6963
commit 3246e0ed94
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
3 changed files with 81 additions and 37 deletions

View file

@ -44,6 +44,10 @@ unsafeFromIns size ins = unsafePerformIO $ do
for_ ins $ \(i,x) => arrayDataSet i x arr
pure $ MkPrimArray size arr
export
unsafeDoIns : List (Nat, a) -> PrimArray a -> IO ()
unsafeDoIns ins arr = for_ ins $ \(i,x) => arrayDataSet i x arr.content
||| Create an array given its size and a function to generate its elements by
||| its index.
export