: graphviz-output-appears-to-exist? ( base -- ? )
"." directory-files [ swap head? ] with count 1 = ;
-: next! ( seq -- elt ) [ first ] [ 1 rotate-headwards! ] bi ;
+: next! ( seq -- elt ) [ first ] [ 1 rotate! ] bi ;
:: smoke-test ( graph -- pass? )
supported-formats get-global next! :> -T
] unit-test
-{ "hello" } [ "hello" 0 rotate-headwards ] unit-test
-{ "llohe" } [ "hello" 2 rotate-headwards ] unit-test
-{ "hello" } [ "hello" dup 0 rotate-headwards! ] unit-test
-{ "lohel" } [ "hello" dup 3 rotate-headwards! ] unit-test
+{ "hello" "hello" } [ "hello" dup 0 rotate ] unit-test
+{ "hello" "llohe" } [ "hello" dup 2 rotate ] unit-test
+[ "hello" dup -1 rotate ] must-fail
+
+{ "hello" } [ "hello" dup 0 rotate! ] unit-test
+{ "lohel" } [ "hello" dup 3 rotate! ] unit-test
+[ "hello" dup -1 rotate! ] must-fail
{ { } } [ { } [ ] map-concat ] unit-test
{ V{ 0 0 1 0 1 2 } } [ 4 iota [ iota ] map-concat ] unit-test
unordered-slices-touch? ;
ERROR: slices-don't-touch slice1 slice2 ;
+
: merge-slices ( slice1 slice2 -- slice/* )
slice-order-by-from
2dup ordered-slices-touch? [
slices-don't-touch
] if ;
-: length- ( n sequence -- m ) length swap - ; inline
-
-: rotate-headwards ( seq n -- seq' )
+: rotate ( seq n -- seq' )
cut prepend ;
-: rotate-tailwards ( seq n -- seq' )
- over length- cut prepend ;
-
-:: rotate-headwards! ( seq n -- )
+:: rotate! ( seq n -- )
n seq bounds-check length :> end
0 n [ 2dup = ] [
[ seq exchange-unsafe ] [ [ 1 + ] bi@ ] 2bi
] until 3drop ;
: all-rotations ( seq -- seq' )
- dup length iota [ rotate-headwards ] with map ;
+ dup length iota [ rotate ] with map ;
<PRIVATE
start-all* length ; inline
: map-zip ( quot: ( x -- y ) -- alist )
- '[ _ keep swap ] map>alist ; inline
\ No newline at end of file
+ '[ _ keep swap ] map>alist ; inline