Previous: , Up: Overview  

1.2 Various utilities

For those uncomfortable with the procedure ordering of the Guile’s native compose procedure, there is a macro compose-top, which just lets the procedures to be executed from top to bottom.

The flexibility of compose procedure is preserved by compose-top. Procedures of a composition aren’t expected to be of the same arity - just the outputs must be matched with the inputs. Here is an example of compose-top composing procedures of different arity:

(define proc (compose-top
              (lambda (val)
                (values val (format #f "New value of: ~a" val)))
              (lambda (val1 val2)
                val2)))
(proc 'the-value)

;; => "New value of: the-value"

Previous: , Up: Overview