kekkonen/util.scm
2021-11-23 19:18:07 +01:00

29 lines
550 B
Scheme

(module util (curry applied thunk just perhaps compose-symbols)
(import scheme)
(import chicken.base)
(import srfi-13)
(define (curry fn a)
(lambda (b)
(fn a b)))
(define (applied fn)
(curry apply fn))
(define-syntax thunk
(syntax-rules ()
((_ exp ...)
(lambda () exp ...))))
(define (just fn)
(lambda args
(fn)))
(define (perhaps fn arg)
(if arg
(fn arg)
arg))
(define (compose-symbols . ln)
(string->symbol (string-concatenate (intersperse (map symbol->string ln) "-")))))