]> gitweb.factorcode.org Git - factor.git/commitdiff
Naive around-advice working
authorJames Cash <james.nvc@gmail.com>
Thu, 6 Nov 2008 05:44:11 +0000 (00:44 -0500)
committerJames Cash <james.nvc@gmail.com>
Thu, 6 Nov 2008 05:44:11 +0000 (00:44 -0500)
extra/advice/advice.factor

index a71b9590f1806787891aa731076c02cb3b43474c..6a7d46f935cfb40b5321a20c5ea0e1edc019f7fc 100644 (file)
@@ -5,8 +5,10 @@ IN: advice
 
 SYMBOLS: before after around advised ;
 
+<PRIVATE
 : advise ( quot name word loc --  )
     word-prop set-at ;
+PRIVATE>
     
 : advise-before ( quot name word --  )
     before advise ;
@@ -15,7 +17,7 @@ SYMBOLS: before after around advised ;
     after advise ;
 
 : advise-around ( quot name word --  )
-    [ \ coterminate suffix cocreate ] 2dip
+    [ \ coterminate suffix ] 2dip
     around advise ;
 
 : get-advice ( word type -- seq )
@@ -28,7 +30,7 @@ SYMBOLS: before after around advised ;
     after get-advice [ call ] each ;
 
 : call-around ( main word --  )
-    around get-advice tuck 
+    around get-advice [ cocreate ] map tuck 
     [ [ coresume ] each ] [ call ] [ reverse [ coresume ] each ] tri* ;
 
 : remove-advice ( name word loc --  )