(require "../lambda/lambda-m.scm") (lambda-m ((list u v)) (list v u)) ;; => ((lambda-m ((list a b c)) (list c b a)) (list 1 2 3)) ;; => (3 2 1) ((lambda-m ((list a b c)) (list c b a)) (list 1 2)) ;; => match error (begin (define-m (p (list a b c)) (list c b a)) (p (list 1 2 3))) ;; => (3 2 1) (begin (define-m (p (list a b c) (list d e)) (list c b a e d)) (p (list 1 2 3) (list 4 5))) ;; => (3 2 1 5 4) (begin (define-m (p (list a b c) (list d e)) (list c b a e d)) (p (list 1 2 3) (list 4 5 6))) ;; => match error (require (only-in srfi/1 unfold)) (unfold (lambda-m ((list a b)) (> (+ a b) 10)) (lambda-m ((list a b)) (/ a b)) (lambda-m ((list a b)) (list (+ a 1) (+ b 1/2))) (list 1 1)) ;; => (1 4/3 3/2 8/5 5/3 12/7) (define (hypotenuse x y) (sqrt (+ (* x x) (* y y)))) (define-m (l-distance (list x1 y1) (list x2 y2)) (hypotenuse (- x2 x1) (- y2 y1))) (l-distance '(0 0) '(1 1)) ;; => 1.4142135623730951 (define-m (v-distance (vector x1 y1) (vector x2 y2)) (hypotenuse (- x2 x1) (- y2 y1))) (v-distance #(0 0) #(1 1)) ;; => 1.4142135623730951