Another utility

db4
Slava Pestov 2008-08-06 05:35:01 -05:00
parent efb6c73f28
commit 569657a2df
1 changed files with 8 additions and 2 deletions

View File

@ -3,10 +3,16 @@
USING: kernel assocs ;
IN: persistent.assocs
GENERIC: new-at ( value key phash -- phash' )
GENERIC: new-at ( value key assoc -- assoc' )
M: assoc new-at clone [ set-at ] keep ;
GENERIC: pluck-at ( key phash -- phash' )
GENERIC: pluck-at ( key assoc -- assoc' )
M: assoc pluck-at clone [ delete-at ] keep ;
: changed-at ( key assoc quot -- assoc' )
[ [ at ] dip call ] [ drop new-at ] 3bi ; inline
: conjoined ( key assoc -- assoc' )
dupd new-at ;