]> gitweb.factorcode.org Git - factor-unmaintained.git/blob - closures/closures.factor
images.processing.rotation: moving to extra/
[factor-unmaintained.git] / closures / closures.factor
1 USING: assocs io.pathnames fry namespaces namespaces.private kernel sequences parser hashtables ;
2 IN: closures
3 SYMBOL: |
4
5 ! Selective Binding
6 : delayed-bind-with ( vars quot -- quot' ) '[ _ dup [ get ] map zip >hashtable [ _ bind ] curry ] ;
7 SYNTAX: C[ | parse-until parse-quotation delayed-bind-with append! ;
8 ! Common ones
9 SYNTAX: DIR[ parse-quotation { current-directory } swap delayed-bind-with append! ;
10
11 ! Namespace Binding
12 : bind-to-namespace ( quot -- quot' ) '[ namespace [ _ bind ] curry ] ;
13 SYNTAX: NS[ parse-quotation bind-to-namespace append! ;