mirror of
https://github.com/nineties/planckforth
synced 2024-12-26 21:58:42 +01:00
Move OUT-OF-RANGE from lib/array.fs to lib/core.fs
This commit is contained in:
parent
8a3d114ae5
commit
0710e59677
2 changed files with 3 additions and 3 deletions
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
private{
|
private{
|
||||||
|
|
||||||
( === Allocation strategy === )
|
|
||||||
defined? array-alloc-strategy [unless]
|
defined? array-alloc-strategy [unless]
|
||||||
|
|
||||||
\ Compute new capacity
|
\ Compute new capacity
|
||||||
|
@ -21,8 +20,6 @@ struct
|
||||||
int% field array>capa
|
int% field array>capa
|
||||||
end-struct array%
|
end-struct array%
|
||||||
|
|
||||||
s" Index out of range" exception constant OUT-OF-RANGE export
|
|
||||||
|
|
||||||
\ Allocate array with capacity
|
\ Allocate array with capacity
|
||||||
: allocate-array ( n capa -- arr )
|
: allocate-array ( n capa -- arr )
|
||||||
array% %allocate throw
|
array% %allocate throw
|
||||||
|
|
|
@ -16,6 +16,9 @@ s" Invalid argument" exception constant INVALID-ARGUMENT
|
||||||
unless INVALID-ARGUMENT throw then
|
unless INVALID-ARGUMENT throw then
|
||||||
;
|
;
|
||||||
|
|
||||||
|
( === Builtin Exceptions === )
|
||||||
|
s" Index out of range" exception constant OUT-OF-RANGE export
|
||||||
|
|
||||||
defined? roll [unless]
|
defined? roll [unless]
|
||||||
: roll ( w[n-1] ... w0 n -- w0 w[n-2] ... w0 w[n-1] )
|
: 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
|
dup 0<= if drop else swap >r 1- recurse r> swap then
|
||||||
|
|
Loading…
Reference in a new issue