factor/extra/closures/closures.factor

13 lines
575 B
Factor
Raw Normal View History

USING: assocs io.pathnames fry namespaces namespaces.private kernel sequences parser hashtables ;
IN: closures
2009-05-27 20:37:24 -04:00
SYMBOL: |
2009-05-31 12:56:39 -04:00
! Selective Binding
: delayed-bind-with ( vars quot -- quot' ) '[ _ dup [ get ] map zip >hashtable [ _ bind ] curry ] ;
2009-05-27 20:37:24 -04:00
SYNTAX: C[ | parse-until parse-quotation delayed-bind-with over push-all ;
! Common ones
2009-05-31 12:56:39 -04:00
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 ;