Fix groups set-length
parent
4b32fa4d05
commit
78bd877339
|
@ -1,4 +1,4 @@
|
||||||
USING: splitting tools.test ;
|
USING: splitting tools.test kernel sequences arrays ;
|
||||||
IN: splitting.tests
|
IN: splitting.tests
|
||||||
|
|
||||||
[ { 1 2 3 } 0 group ] must-fail
|
[ { 1 2 3 } 0 group ] must-fail
|
||||||
|
@ -56,3 +56,9 @@ unit-test
|
||||||
[ { "hello" "hi" } ] [ "hello\nhi" string-lines ] unit-test
|
[ { "hello" "hi" } ] [ "hello\nhi" string-lines ] unit-test
|
||||||
[ { "hello" "hi" } ] [ "hello\rhi" string-lines ] unit-test
|
[ { "hello" "hi" } ] [ "hello\rhi" string-lines ] unit-test
|
||||||
[ { "hello" "hi" } ] [ "hello\r\nhi" string-lines ] unit-test
|
[ { "hello" "hi" } ] [ "hello\r\nhi" string-lines ] unit-test
|
||||||
|
|
||||||
|
[ { V{ "a" "b" } V{ f f } } ] [
|
||||||
|
V{ "a" "b" } clone 2 <groups>
|
||||||
|
2 over set-length
|
||||||
|
>array
|
||||||
|
] unit-test
|
||||||
|
|
|
@ -17,7 +17,7 @@ M: groups length
|
||||||
dup groups-seq length swap groups-n [ + 1- ] keep /i ;
|
dup groups-seq length swap groups-n [ + 1- ] keep /i ;
|
||||||
|
|
||||||
M: groups set-length
|
M: groups set-length
|
||||||
[ groups-n * ] keep delegate set-length ;
|
[ groups-n * ] keep groups-seq set-length ;
|
||||||
|
|
||||||
: group@ ( n groups -- from to seq )
|
: group@ ( n groups -- from to seq )
|
||||||
[ groups-n [ * dup ] keep + ] keep
|
[ groups-n [ * dup ] keep + ] keep
|
||||||
|
|
Loading…
Reference in New Issue