mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
don't assume map works on improper lists in cpp-define
This commit is contained in:
parent
7854371728
commit
9710962cd2
1 changed files with 8 additions and 1 deletions
|
@ -398,6 +398,11 @@
|
||||||
((null? x) #f)
|
((null? x) #f)
|
||||||
(else x)))
|
(else x)))
|
||||||
|
|
||||||
|
(define (list-without-dot x)
|
||||||
|
(let lp ((ls x) (res '()))
|
||||||
|
(cond ((pair? ls) (lp (cdr ls) (cons (car ls) res)))
|
||||||
|
(else (reverse res)))))
|
||||||
|
|
||||||
(define (replace-tree from to x)
|
(define (replace-tree from to x)
|
||||||
(let replace ((x x))
|
(let replace ((x x))
|
||||||
(cond ((eq? x from) to)
|
(cond ((eq? x from) to)
|
||||||
|
@ -422,7 +427,9 @@
|
||||||
(in-macro? (pair? x))
|
(in-macro? (pair? x))
|
||||||
(macro-vars
|
(macro-vars
|
||||||
(map (lambda (v) (if (pair? v) (cadr v) v))
|
(map (lambda (v) (if (pair? v) (cadr v) v))
|
||||||
(if (pair? x) x (list x))))
|
(if (pair? x)
|
||||||
|
(list-without-dot x)
|
||||||
|
(list x))))
|
||||||
(op 'zero))
|
(op 'zero))
|
||||||
(c-in-expr (apply c-begin body)))))
|
(c-in-expr (apply c-begin body)))))
|
||||||
"")))
|
"")))
|
||||||
|
|
Loading…
Add table
Reference in a new issue