From ab56eb0e48b9e1f82b035ab43ff6bf491815eb98 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 17 Aug 2008 21:27:35 -0500 Subject: [PATCH] add ?at, simplify if-at --- extra/assocs/lib/lib.factor | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extra/assocs/lib/lib.factor b/extra/assocs/lib/lib.factor index 5f4620fd64..2a8634987f 100755 --- a/extra/assocs/lib/lib.factor +++ b/extra/assocs/lib/lib.factor @@ -38,8 +38,11 @@ IN: assocs.lib swap [ change-at ] 2curry assoc-each ] keep ; inline +: ?at ( obj1 assoc -- obj1/obj2 ) + dupd at* [ nip ] [ drop ] if ; + : if-at ( obj assoc quot1 quot2 -- ) - [ dupd at* [ not -rot ? ] keep ] 2dip if ; inline + [ ?at dup ] 2dip if ; inline : when-at ( obj assoc quot -- ) [ ] if-at ; inline