- write-example data description expressionsprocedure
Renders an example, evaluating the expressions; attempts to require-extension all modules seen so far.
(define (write-example data description expressions) (display description) (newline) (let ((env (interaction-environment)) (modules (hash-table-ref/default data 'modules '()))) (for-each (lambda (module) (eval `(require-extension ,module) env)) modules) (for-each (lambda (expression) (fmt #t (columnar " " (with-width 78 (pretty expression)))) (fmt #t (columnar " => " (with-width 74 (pretty (eval expression env)))) " " nl)) expressions)))