mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
* testsuite: Move to... * test-suite/vm: ... here. * Makefile.am (SUBDIRS): Remove `testsuite'. * configure.ac: Output `test-suite/vm/Makefile' instead of `testsuite/Makefile'. * test-suite/Makefile.am (SUBDIRS): Add `vm'.
22 lines
855 B
Scheme
22 lines
855 B
Scheme
(define (extract-symbols exp)
|
|
(define (process x out cont)
|
|
(cond ((pair? x)
|
|
(process (car x)
|
|
out
|
|
(lambda (car-x out)
|
|
;; used to have a bug here whereby `x' was
|
|
;; modified in the self-tail-recursion to (process
|
|
;; (cdr x) ...), because we didn't allocate fresh
|
|
;; externals when doing self-tail-recursion.
|
|
(process (cdr x)
|
|
out
|
|
(lambda (cdr-x out)
|
|
(cont (cons car-x cdr-x)
|
|
out))))))
|
|
((symbol? x)
|
|
(cont x (cons x out)))
|
|
(else
|
|
(cont x out))))
|
|
(process exp '() (lambda (x out) out)))
|
|
|
|
(extract-symbols '(a b . c))
|