d-/d-.scm
2024-10-23 09:02:27 -05:00

21 lines
456 B
Scheme

(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))))