"NS[" syntax added to closures

db4
Sam Anklesaria 2009-05-31 11:56:39 -05:00
parent 3a8267f30f
commit e7cc0d02c6
1 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,13 @@
USING: assocs io.pathnames fry namespaces kernel sequences parser ;
USING: assocs io.pathnames fry namespaces namespaces.private kernel sequences parser ;
IN: closures
SYMBOL: |
! Selective Binding
: delayed-bind-with ( vars quot -- quot' ) '[ _ dup [ get ] map zip [ _ bind ] curry ] ;
SYNTAX: C[ | parse-until parse-quotation delayed-bind-with over push-all ;
! Common ones
SYNTAX: DIR[ parse-quotation { current-directory } swap delayed-bind-with over push-all ;
SYNTAX: DIR[ parse-quotation { current-directory } swap delayed-bind-with over push-all ;
! Namespace Binding
: bind-to-namespace ( quot -- quot' ) '[ namespace [ _ bind ] curry ] ;
SYNTAX: NS[ parse-quotation bind-to-namespace over push-all ;