(define-module (d-) #:export (~> ~>> partial)) (define-syntax ~> (syntax-rules () [(_ v) v] [(_ v (fn args ...) more ...) (~> (fn v args ...) more ...)] [(_ v fn more ...) (~> (fn v) more ...)])) (define-syntax ~>> (syntax-rules () [(_ v) v] [(_ v (fn args ...) more ...) (~> (fn args ... v) more ...)] [(_ v fn more ...) (~> (fn v) more ...)])) (define (partial fn . args) (lambda x (apply fn (append args x))))