diff --git a/lib/array.fs b/lib/array.fs index e7fc5b7..12d32c4 100644 --- a/lib/array.fs +++ b/lib/array.fs @@ -5,7 +5,6 @@ private{ -( === Allocation strategy === ) defined? array-alloc-strategy [unless] \ Compute new capacity @@ -21,8 +20,6 @@ struct int% field array>capa end-struct array% -s" Index out of range" exception constant OUT-OF-RANGE export - \ Allocate array with capacity : allocate-array ( n capa -- arr ) array% %allocate throw diff --git a/lib/core.fs b/lib/core.fs index 297ee6d..03652fa 100644 --- a/lib/core.fs +++ b/lib/core.fs @@ -16,6 +16,9 @@ s" Invalid argument" exception constant INVALID-ARGUMENT unless INVALID-ARGUMENT throw then ; +( === Builtin Exceptions === ) +s" Index out of range" exception constant OUT-OF-RANGE export + defined? roll [unless] : roll ( w[n-1] ... w0 n -- w0 w[n-2] ... w0 w[n-1] ) dup 0<= if drop else swap >r 1- recurse r> swap then