add if-at, when-at, and unless-at

it's like if-empty
db4
Doug Coleman 2008-08-17 12:01:04 -05:00
parent 507f814d48
commit c56a769fef
1 changed files with 7 additions and 0 deletions
extra/assocs/lib

View File

@ -37,3 +37,10 @@ IN: assocs.lib
H{ } clone [
swap [ change-at ] 2curry assoc-each
] keep ; inline
: if-at ( obj assoc quot1 quot2 -- )
[ dupd at* [ not -rot ? ] keep ] 2dip if ; inline
: when-at ( obj assoc quot -- ) [ ] if-at ; inline
: unless-at ( obj assoc quot -- ) [ ] swap if-at ; inline