grouping: change chunking to throw bounds-errors in nth.

instead of the more confusing slice-error.
windows-high-dpi
John Benediktsson 2018-03-05 16:57:52 -08:00
parent e749734b01
commit 551144b8a2
2 changed files with 2 additions and 3 deletions

View File

@ -2,6 +2,7 @@ USING: grouping tools.test kernel sequences arrays
math accessors ;
[ { 1 2 3 } 0 group ] must-fail
[ f 3 <groups> first ] [ bounds-error? ] must-fail-with
{ { "hell" "o wo" "rld" } } [ "hello world" 4 group ] unit-test

View File

@ -14,11 +14,9 @@ TUPLE: chunking { seq read-only } { n read-only } ;
INSTANCE: chunking sequence
M: chunking nth group@ <slice> ; inline
M: chunking nth-unsafe group@ <slice-unsafe> ; inline
M: chunking set-nth group@ <slice> 0 swap copy ;
M: chunking set-nth-unsafe group@ <slice-unsafe> 0 swap copy ;
M: chunking like drop { } like ; inline