From 0710e596770341276394b0226ea935032d386867 Mon Sep 17 00:00:00 2001 From: Koichi Nakamura Date: Wed, 8 Dec 2021 07:42:38 +0900 Subject: [PATCH] Move OUT-OF-RANGE from lib/array.fs to lib/core.fs --- lib/array.fs | 3 --- lib/core.fs | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) 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