29 lines
550 B
Scheme
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) "-")))))
|