 : length-operator ( seq quot -- n quot' )
     [ length-iterator ] dip compose ; inline
 
+: length-operator-last ( seq quot -- n quot' )
+    length-operator [ 1 - ] dip ; inline
+
 : sequence-operator-from ( seq quot i -- i n quot' )
     -rot length-operator ; inline
+
+: sequence-operator-last-from ( seq quot i -- n quot' )
+    -rot length-operator-last nip ; inline
 
 : collect ( n quot into -- )
     [ [ keep ] dip set-nth-unsafe ] 2curry each-integer ; inline

: 3map ( ... seq1 seq2 seq3 quot: ( ... elt1 elt2 elt3 -- ... newelt ) -- ... newseq )
    pickd swap 3map-as ; inline

: find-from ( ... n seq quot: ( ... elt -- ... ? ) -- ... i elt )
    [ find-integer-from ] (find-from) ; inline

: find ( ... seq quot: ( ... elt -- ... ? ) -- ... i elt )
    [ find-integer ] (find) ; inline

: find-last-from ( ... n seq quot: ( ... elt -- ... ? ) -- ... i elt )
    [ nip find-last-integer ] (find-from) ; inline

: find-last ( ... seq quot: ( ... elt -- ... ? ) -- ... i elt )
    [ [ 1 - ] dip find-last-integer ] (find) ; inline

: find-index-from ( ... n seq quot: ( ... elt i -- ... ? ) -- ... i elt )
    [ find-integer-from ] (find-index-from) ; inline

: find-index ( ... seq quot: ( ... elt i -- ... ? ) -- ... i elt )
    [ find-integer ] (find-index) ; inline

: all? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? )
    sequence-operator all-integers-from? ; inline

: ?set-nth ( elt n seq -- )
    2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; inline

: maybe-nth ( i/f seq -- elt/f )
    over [ nth ] [ 2drop f ] if ; inline

: ?first ( seq -- elt/f ) 0 swap ?nth ; inline
: ?second ( seq -- elt/f ) 1 swap ?nth ; inline
: ?last ( seq -- elt/f )
