mes/closure.mes
2016-07-17 14:47:56 +02:00

29 lines
695 B
Plaintext

;; guile:
;; closure path=(3 2 1)
;; closure path=()
;; mapit path=(3 2 1)
;; closure path=(2 1)
;; mes:
;; closure path=(3 2 1)
;; closure path=()
;; mapit path=()
;; ()
(define (closure start? path mapit)
(display "closure path=") (display path) (newline)
(cond (start?
(closure #f '() ;;path
(lambda (x)
(display "mapit path=") (display path) (newline)
(cond ((null? path) path)
(#t
(closure #f (cdr path) mapit)
)))))
(#t (mapit path))))
(closure #t '(3 2 1) (lambda (x) (display "dun") (newline)))