 
 : cache ( key assoc quot -- value )
     2over at* [
-        >r 3drop r>
+        [ 3drop ] dip
     ] [
-        drop pick rot >r >r call dup r> r> set-at
+        drop pick rot [ call dup ] 2dip set-at
     ] if ; inline
 
 : change-at ( key assoc quot -- )
-    [ >r at r> call ] 3keep drop set-at ; inline
+    [ [ at ] dip call ] 3keep drop set-at ; inline
 
 : at+ ( n key assoc -- )
     [ 0 or + ] change-at ;

    (assoc-each) each ; inline

: assoc>map ( assoc quot exemplar -- seq )
    >r accumulator >r assoc-each r> r> like ; inline

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

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

: assoc-push-if ( key value quot accum -- )
    >r 2keep r> roll
    [ >r 2array r> push ] [ 3drop ] if ; inline

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

: assoc-filter ( assoc quot -- subassoc )
    over >r assoc-pusher >r assoc-each r> r> assoc-like ; inline

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

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

M: sequence new-assoc drop <vector> ;

