     [ length 1- ] keep (assoc-stack) ; flushable
 
 : assoc-subset? ( assoc1 assoc2 -- ? )
-    [ swapd at* [ = ] [ 2drop f ] if ] curry assoc-all? ;
+    [ at* [ = ] [ 2drop f ] if ] with-assoc assoc-all? ;
 
 : assoc= ( assoc1 assoc2 -- ? )
     [ assoc-subset? ] [ swap assoc-subset? ] 2bi and ;


M: assoc assoc-clone-like ( assoc exemplar -- newassoc )
    [ dup assoc-size ] dip new-assoc
    [ [ swapd set-at ] curry assoc-each ] keep ;

: keys ( assoc -- keys )
    [ drop ] { } assoc>map ;

: substituter ( assoc -- quot )
    [ dupd at* [ nip ] [ drop ] if ] curry ; inline

: with-assoc ( assoc quot: ( value key -- assoc ) -- quot: ( key value -- ) )
    curry [ swap ] prepose ; inline

PRIVATE>

: assoc-find ( assoc quot -- key value ? )
