filter out '()s from the tree
This commit is contained in:
10
sexc.scm
10
sexc.scm
@@ -3,7 +3,9 @@
|
|||||||
(chicken string)
|
(chicken string)
|
||||||
fmt
|
fmt
|
||||||
fmt-c
|
fmt-c
|
||||||
getopt-long)
|
getopt-long
|
||||||
|
srfi-1 ; list routines
|
||||||
|
)
|
||||||
|
|
||||||
(define (unkebabify sym)
|
(define (unkebabify sym)
|
||||||
(string->symbol
|
(string->symbol
|
||||||
@@ -63,7 +65,8 @@ If filter-proc returns something other, use it instead of processing the element
|
|||||||
(cons
|
(cons
|
||||||
(let ((r (read)))
|
(let ((r (read)))
|
||||||
(when (eof-object? r)
|
(when (eof-object? r)
|
||||||
(return (reverse collect)))
|
(return (filter (lambda (e) (not (null? e)))
|
||||||
|
(reverse collect))))
|
||||||
(case (car r)
|
(case (car r)
|
||||||
((define)
|
((define)
|
||||||
(eval r)
|
(eval r)
|
||||||
@@ -76,8 +79,7 @@ If filter-proc returns something other, use it instead of processing the element
|
|||||||
|
|
||||||
(define (emit-c forms)
|
(define (emit-c forms)
|
||||||
(map (lambda (form)
|
(map (lambda (form)
|
||||||
(if (not (null? form))
|
(fmt #t (c-expr form))
|
||||||
(fmt #t (c-expr form)))
|
|
||||||
(fmt #t "\n"))
|
(fmt #t "\n"))
|
||||||
forms))
|
forms))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user