1 ! Copyright (C) 2012 John Benediktsson
2 ! See https://factorcode.org/license.txt for BSD license
3 USING: accessors kernel math sequences ;
6 TUPLE: rotated < sequence-view
7 { n integer read-only } ;
12 [ n>> + ] [ seq>> ] bi [
13 length over 0 < [ + ] [
14 2dup >= [ - ] [ drop ] if
18 : all-rotations ( seq -- seq' )
19 dup length <iota> [ <rotated> ] with map ;