 : follow ( obj quot -- seq )
     [ dup ] swap [ keep ] curry produce nip ; inline
 
-: prepare-index ( seq quot -- seq n quot )
-    [ dup length ] dip ; inline
-
 : each-index ( seq quot -- )
-    prepare-index 2each ; inline
+    (each-index) each-integer ; inline
 
 : interleave ( seq between quot -- )
     swap [ drop ] [ [ 2dip call ] 2curry ] 2bi


<PRIVATE

: (each) ( seq quot -- n quot' )
    [ [ length ] keep [ nth-unsafe ] curry ] dip compose ; inline

: (collect) ( quot into -- quot' )
    [ [ keep ] dip set-nth-unsafe ] 2curry ; inline

    each-index ; inline

: map-index ( seq quot -- newseq )
    [ dup length iota ] dip 2map ; inline

: reduce-index ( seq identity quot -- )
    swapd each-index ; inline
