Hi Adam,
On Sun, 8 Mar 2020 23:26:41 +0800 Adam adam.mlmb@gmail.com wrote:
Hi Marc,
Cool, wonderful!
Yeah for any situation like
(define (a) ; Teleport from hr (b)) (define (b) (c)) (define (c) ; Teleport to hr #!void)
, just totally great.
Before you fall too deeply in love with parameters, beware that heavily parameterized code can easily become hard to read:
$ gsi
(define p-a (make-parameter 46)) (define p-b (make-parameter 23)) (define p-op (make-parameter -))
(define (doit!) (let ((op (p-op)) (a (p-a)) (b (p-b))) (display `("calculating ( " ,op " ) applied to" ,a "and" ,b)) (newline) (op a b)))
(parameterize ((p-op *) (p-a 21) (p-b 2)) (doit!))
;; => ;; (calculating ( #<procedure #11 *> ) applied to 21 and 2) ;; 42
;; Great!
(load "magic.scm") ;; attached file magic.scm
(define dare! (magic doit!))
(parameterize ((p-op *) (p-a 21) (p-b 2)) (dare!)) ;; => ;; (calculating ( #<procedure #4 -> ) applied to 46 and 23) ;; 23
;; YMMV, but I find this not exactly intuitive.
Regards
/Jörg