mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-17 13:27:30 +03:00
763 B
763 B
arrayList v n = do
use ImmutableByteArray read8
ma = Scope.bytearrayOf v n
a = freeze! ma
go acc i =
acc' = [read8 a i] ++ acc
if i == 0
then acc'
else go acc' (drop i 1)
go [] (drop n 1)
> Scope.run '(catch (arrayList 7 8))
Loading changes detected in scratch.u.
I found and typechecked these definitions in scratch.u. If you
do an `add` or `update`, here's how your codebase would
change:
⍟ These new definitions are ok to `add`:
arrayList : Nat -> Nat -> '{Exception, Scope s} [Nat]
Now evaluating any watch expressions (lines starting with
`>`)... Ctrl+C cancels.
12 | > Scope.run '(catch (arrayList 7 8))
⧩
Right [7, 7, 7, 7, 7, 7, 7, 7]