With some test procedures:
#lang racket
(define (foo x) (+ x 1))
(define (bar x) (* x 2))
(define (baz x) (+ x 3))
I can "manually" use compose
to get the right result:
((compose foo bar baz) 1) ;; works
...but is there a way to use compose
with a list? The closest I can get is a quoted list, and I'd prefer not to use eval if I don't have to.
(define test-funcs '(foo bar baz))
((compose test-funcs) 1) ;; expected: procedure? given: '(#<procedure:foo> #<procedure:bar> #<procedure:baz>)
((compose . test-funcs) 1) ;; #%app: bad syntax
`((compose . ,test-funcs) 1) ;; almost: '((compose foo bar baz) 1)