sequences: normalize all the "?set-nth" words, probably this should be a stdlib thing.
parent
b62444680b
commit
f8f5feed4a
|
@ -19,13 +19,18 @@ M: bit-set adjoin
|
|||
! go in the set
|
||||
[ t ] 2dip table>> set-nth ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
: ?set-nth ( elt n seq -- )
|
||||
2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; inline
|
||||
|
||||
PRIVATE>
|
||||
|
||||
M: bit-set delete
|
||||
! This isn't allowed to throw an error if the elt wasn't
|
||||
! in the set
|
||||
over integer? [
|
||||
table>> 2dup bounds-check? [
|
||||
[ f ] 2dip set-nth
|
||||
] [ 2drop ] if
|
||||
[ f ] 2dip table>> ?set-nth
|
||||
] [ 2drop ] if ;
|
||||
|
||||
! If you do binary set operations with a bit-set, it's expected
|
||||
|
|
|
@ -177,8 +177,8 @@ CONSTANT: pov-values
|
|||
|
||||
HINTS: record-controller { controller-state alien } ;
|
||||
|
||||
: ?set-nth ( value nth seq -- )
|
||||
2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ;
|
||||
: ?set-nth ( elt n seq -- )
|
||||
2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; inline
|
||||
|
||||
: record-keyboard ( keyboard-state value -- )
|
||||
dup IOHIDValueGetElement dup keyboard-key? [
|
||||
|
|
|
@ -138,8 +138,8 @@ PRIVATE>
|
|||
|
||||
! the maximum unicode char in the first 3 planes
|
||||
|
||||
: ?set-nth ( val index seq -- )
|
||||
2dup bounds-check? [ set-nth ] [ 3drop ] if ;
|
||||
: ?set-nth ( elt n seq -- )
|
||||
2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; inline
|
||||
|
||||
:: fill-ranges ( table -- table )
|
||||
name-map sort-values keys
|
||||
|
|
|
@ -10,8 +10,12 @@ SYMBOL: visited
|
|||
|
||||
: unvisited? ( cell -- ? ) first2 visited get ?nth ?nth ;
|
||||
|
||||
: ?set-nth ( elt i seq -- )
|
||||
2dup bounds-check? [ set-nth ] [ 3drop ] if ;
|
||||
<PRIVATE
|
||||
|
||||
: ?set-nth ( elt n seq -- )
|
||||
2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; inline
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: visit ( cell -- ) f swap first2 visited get ?nth ?set-nth ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue