 TUPLE: to-sequence { seq sequence } { exemplar sequence } ;
 
 M: to-sequence cursor-write
-   seq>> push ;
+    seq>> push ;
 
 : freeze ( cursor -- seq )
-   [ seq>> ] [ exemplar>> ] bi like ; inline
+    [ seq>> ] [ exemplar>> ] bi like ; inline
 
 : >output ( seq -- cursor )
-   [ [ length ] keep new-resizable ] keep
-   to-sequence boa ; inline
+    [ [ length ] keep new-resizable ] keep
+    to-sequence boa ; inline
 
 : transform ( seq quot transformer -- newseq )
-   [ [ >input ] [ >output ] bi ] 2dip
-   [ call ] [ 2drop freeze ] 3bi ; inline
+    [ [ >input ] [ >output ] bi ] 2dip
+    [ call ]
+    [ 2drop freeze ] 3bi ; inline
 
 : map ( seq quot -- ) [ cursor-map ] transform ; inline
 : filter ( seq quot -- newseq ) [ cursor-filter ] transform ; inline

    [ cursor-write ] 2curry when ; inline

: cursor-filter-quot ( quot to -- quot' )
   [ cursor-write-if ] 2curry ; inline

: cursor-filter ( from to quot -- )
   swap cursor-filter-quot cursor-each ; inline

TUPLE: from-sequence { seq sequence } { n integer } ;


    >from-sequence< length >= ;

M: from-sequence cursor-valid?
    >from-sequence< bounds-check? not ;

M: from-sequence cursor-get-unsafe
    >from-sequence< nth-unsafe ;

M: from-sequence cursor-advance
    [ 1+ ] change-n drop ;

: >input ( seq -- cursor )
    0 from-sequence boa ; inline

: iterate ( seq quot iterator -- )
    [ >input ] 2dip call ; inline

: each ( seq quot -- ) [ cursor-each ] iterate ; inline
: find ( seq quot -- ? ) [ cursor-find ] iterate ; inline
