 GENERIC: >alist ( assoc -- newassoc )
 
 : (assoc-each) ( assoc quot -- seq quot' )
-    >r >alist r> [ first2 ] prepose ; inline
+    [ >alist ] dip [ first2 ] prepose ; inline
 
 : assoc-find ( assoc quot -- key value ? )
     (assoc-each) find swap [ first2 t ] [ drop f f f ] if ; inline

M: sequence set-at
    2dup search-alist
    [ 2nip set-second ]
    [ drop >r swap 2array r> push ] if ;

M: sequence new-assoc drop <vector> ;


    (assoc-each) each ; inline

: assoc>map ( assoc quot exemplar -- seq )
    [ accumulator [ assoc-each ] dip ] dip like ; inline

: assoc-map-as ( assoc quot exemplar -- newassoc )
    [ [ 2array ] compose V{ } assoc>map ] dip assoc-like ; inline

: assoc-map ( assoc quot -- newassoc )
    over assoc-map-as ; inline

: assoc-push-if ( key value quot accum -- )
    [ 2keep rot ] dip swap
    [ [ 2array ] dip push ] [ 3drop ] if ; inline

: assoc-pusher ( quot -- quot' accum )
    V{ } clone [ [ assoc-push-if ] 2curry ] keep ; inline

: assoc-filter-as ( assoc quot exemplar -- subassoc )
    [ assoc-pusher [ assoc-each ] dip ] dip assoc-like ; inline

: assoc-filter ( assoc quot -- subassoc )
    over assoc-filter-as ; inline

: assoc-contains? ( assoc quot -- ? )
    assoc-find 2nip ; inline
