#! /bin/bash exec guile -s "$0" !# (use-modules (ice-9 pretty-print) (srfi srfi-1)) ;;; First, show that "fold" is in a good state (cf. srfi/srfi-1.scm). (display "Original source for FOLD:\n") (pretty-print (procedure-source fold)) (display "\n\n") ;;; Run "fold" with "+" as the KONS. (fold + 0 '(1 2 3 4 5)) ;;; Show that the source has NOT been altered (substantially) (display "(More or less) Unaltered source for FOLD:\n") (pretty-print (procedure-source fold)) (display "\n\n") ;;; Run "fold" with a macro as the KONS argument. (define-macro (++ a b) `(+ ,a ,b)) (fold ++ 0 '(1 2 3 4 5)) (display "Altered (broken) source for FOLD:\n") (pretty-print (procedure-source fold)) (display "\n\n")