source: project/release/4/expand-full/trunk/expand-full.scm @ 14068

Last change on this file since 14068 was 14068, checked in by Kon Lovett, 11 years ago

Save.

File size: 966 bytes
Line 
1;;;; expand-full.scm
2;;;; Kon Lovett, Apr '09
3
4(declare
5  (usual-integrations)
6  (fixnum)
7  (inline)
8  (local)
9  (no-procedure-checks))
10
11;;;
12
13(module expand-full (expand* pretty-print-expand* ppexpand*)
14
15(import scheme chicken
16  (only csi toplevel-command)
17  (only extras pretty-print)
18  (only data-structures atom?)
19  (only srfi-1 map!))
20
21(require-library extras data-structures srfi-1)
22
23;;;
24
25;;
26
27(define (expand* form #!optional se)
28  (define (exp form)
29    (if (atom? form) form
30        (let ((form* (expand* form se)))
31          (if (equal? form form*) form
32              (exp form*) ) ) ) )
33  (map! exp (expand form se)) )
34
35;;
36
37(define (pretty-print-expand* form . args)
38  (pretty-print (strip-syntax (apply expand* form args)))
39  (void) )
40
41(define ppexpand* pretty-print-expand*)
42
43;;;
44
45(when (feature? csi:)
46  (toplevel-command 'x*
47    (lambda () (ppexpand* (read)))
48    ",x* EXP           Pretty print fully expanded expression EXP") )
49
50) ;module expand-full
Note: See TracBrowser for help on using the repository browser.