sequences: Rename slice-error the word to check-slice-error, make slice-error the TUPLE: an ERROR:

db4
Doug Coleman 2013-03-04 16:57:49 -08:00
parent 843426c664
commit 9af2924924
1 changed files with 6 additions and 6 deletions

View File

@ -217,16 +217,16 @@ TUPLE: slice
: collapse-slice ( m n slice -- m' n' seq )
[ from>> ] [ seq>> ] bi [ [ + ] curry bi@ ] dip ; inline
TUPLE: slice-error from to seq reason ;
ERROR: slice-error from to seq reason ;
: slice-error ( from to seq ? string -- from to seq )
[ \ slice-error boa throw ] curry when ; inline
: check-slice-error ( from to seq ? string -- from to seq )
[ slice-error ] curry when ; inline
: check-slice ( from to seq -- from to seq )
3dup
[ 2drop 0 < "start < 0" slice-error ]
[ [ drop ] 2dip length > "end > sequence" slice-error ]
[ drop > "start > end" slice-error ]
[ 2drop 0 < "start < 0" check-slice-error ]
[ [ drop ] 2dip length > "end > sequence" check-slice-error ]
[ drop > "start > end" check-slice-error ]
3tri ; inline
<PRIVATE