]> gitweb.factorcode.org Git - factor.git/commitdiff
cursors: 2each, 2map-as, 2map, using zip-cursors
authorJoe Groff <arcata@gmail.com>
Wed, 24 Mar 2010 22:26:50 +0000 (15:26 -0700)
committerJoe Groff <arcata@gmail.com>
Wed, 24 Mar 2010 22:26:50 +0000 (15:26 -0700)
extra/cursors/cursors.factor

index 84b3d0ef78940305e8be5808975cd7997bf805ef..1d02311c2fd7b547ea37120f2d563dc9b36a473e 100644 (file)
@@ -484,5 +484,11 @@ ALIAS: -2container- -assoc-
 : 2container- ( a b quot -- begin end quot' )
     2all- -2container- ; inline
 
+: 2each ( ... a b quot: ( ... x y -- ... ) -- ... )
+    2container- -each ; inline
 
+: 2map-as ( ... a b quot: ( ... x y -- ... z ) exemplar -- ... c )
+    [ 2container- ] dip -map-as ; inline
 
+: 2map ( ... a b quot: ( ... x y -- ... z ) -- ... c )
+    pick 2map-as ; inline