 TUPLE: sequence-output-cursor < cursor seq n ;
 CONSTRUCTOR: <sequence-output-cursor> sequence-output-cursor ( seq n -- obj ) ;
 
-TUPLE: mapping-cursor < cursor input output ;
-CONSTRUCTOR: <mapping-cursor> mapping-cursor ( input output -- obj ) ;
+TUPLE: mapping-cursor < cursor output input ;
+CONSTRUCTOR: <mapping-cursor> mapping-cursor ( output input -- obj ) ;
 
 TUPLE: alist-cusor < cursor alist n ;
 

    [ >input-cursor ] dip (find2) ; inline


: (each2) ( cursor quot: ( cursor obj -- ) -- )
    over cursor-at [
        [ swap call ] 3keep drop
        [ cursor-inc-input ] dip (each2)
    ] [
        3drop
    ] if ; inline recursive


: (map2) ( cursor quot: ( cursor obj -- obj' ) -- out )
    over input>> cursor-at [
        swap mapping-cursor-advance (map2)
    ] [
        2drop output>>
    ] if ; inline recursive

: map2 ( obj quot -- obj' )
    [ input>mapping-cursor ] dip (map2) ; inline


: (filter2) ( cursor quot: ( cursor obj -- obj' ) -- out )
    over input>> cursor-at [
        swap filter-cursor-advance (filter2)
    ] [
        2drop output>>
    ] if ; inline recursive

: filter2 ( obj quot -- obj' )
    [ input>mapping-cursor ] dip (filter2) ; inline
