Ticket #1654: holes.patch
File holes.patch, 2.1 KB (added by , 4 years ago) |
---|
-
holes-params.scm
1 (module holes-params (hole-delimiters) 2 (import scheme (only (chicken base) make-parameter)) 3 4 (define hole-delimiters 5 (make-parameter "<>" 6 (lambda (arg) 7 (if (and (string? arg) 8 (or (string=? arg "!!") 9 (string=? arg "<>"))) 10 arg 11 "<>")) 12 ))) -
holes.egg
5 5 (test-dependencies simple-tests) 6 6 (author "[[Juergen Lorenz]]") 7 7 (version "1.1") 8 (components (extension holes )))9 10 8 (components (extension holes 9 (component-dependencies holes-params)) 10 (extension holes-params))) -
holes.scm
55 55 set-sharp-read-syntax! 56 56 set-read-syntax!)) 57 57 (import-for-syntax (only (chicken base) receive) 58 (only (chicken fixnum) fx- fx+ fx=)) 58 (only (chicken fixnum) fx- fx+ fx=) 59 holes-params) 59 60 60 (define-for-syntax hole-delimiters61 (make-parameter "<>"62 (lambda (arg)63 (if (and (string? arg)64 (or (string=? arg "!!")65 (string=? arg "<>")))66 arg67 "<>"))68 ))69 61 ;;; (@@ code) 70 62 ;;; --------- 71 63 ;;; returns a procedure with arguments the holes in code -
tests/run.scm
1 1 (import holes simple-tests) 2 (import holes-params) 2 3 3 4 4 (pe '(@@ (+ !1! 5))) 5 5 (pe '(@@ '(1 . 2))) 6 6 (pe '(@@ (+ 5 (* !! 2))))