From c70090bb8378538a94e844571e3499b2531bd095 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Wed, 24 Mar 2010 17:02:10 -0700 Subject: [PATCH] cursors: -with- filter (e.g. foo H{ ... } [ ... ] assoc- -with- -each) --- extra/cursors/cursors.factor | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/extra/cursors/cursors.factor b/extra/cursors/cursors.factor index 94e83398bd..750540844a 100644 --- a/extra/cursors/cursors.factor +++ b/extra/cursors/cursors.factor @@ -517,3 +517,17 @@ MACRO: -ncontainer- ( n -- ) swap [ ncontainer- ] dip -map-as ; inline : nmap ( seqs... quot n -- newseq ) dup [ npick ] curry [ dip swap ] curry dip nmap-as ; inline + +! +! utilities +! + +: -with- ( invariant begin end quot -- begin end quot' ) + [ rot ] dip '[ [ _ ] dip @ ] ; inline + +: -2with- ( invariant invariant begin end quot -- begin end quot' ) + -with- -with- ; inline + +MACRO: -nwith- ( n -- ) + [ -with- ] n*quot ; +