diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-05-17 13:31:39 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-05-17 13:31:39 +0200 |
commit | 43de4dd2e730273eb04bdf7d0ac62ac1e1422880 (patch) | |
tree | 7a91b756734222842999d767378c7544aac1e3bf /src/Data/Array/Mixed.hs | |
parent | 03879dfc925510c13c46664ca3438cc1d4872048 (diff) |
Diffstat (limited to 'src/Data/Array/Mixed.hs')
-rw-r--r-- | src/Data/Array/Mixed.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Data/Array/Mixed.hs b/src/Data/Array/Mixed.hs index 5fbc46f..ce18431 100644 --- a/src/Data/Array/Mixed.hs +++ b/src/Data/Array/Mixed.hs @@ -558,8 +558,11 @@ empty sh = XArray (S.constant (shapeLshape sh) (error "Data.Array.Mixed.empty: shape was not empty")) -slice :: [(Int, Int)] -> XArray sh a -> XArray sh a -slice ivs (XArray arr) = XArray (S.slice ivs arr) +slice :: SNat i -> SNat n -> XArray (Just (i + n + k) : sh) a -> XArray (Just n : sh) a +slice i n (XArray arr) = XArray (S.slice [(fromSNat' i, fromSNat' n)] arr) + +sliceU :: Int -> Int -> XArray (Nothing : sh) a -> XArray (Nothing : sh) a +sliceU i n (XArray arr) = XArray (S.slice [(i, n)] arr) rev1 :: XArray (n : sh) a -> XArray (n : sh) a rev1 (XArray arr) = XArray (S.rev [0] arr) |