mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-13 07:47:39 +02:00
Properly wrap data from c eval
This commit is contained in:
parent
88f5d29930
commit
4fbd1bf1da
1 changed files with 15 additions and 2 deletions
|
@ -53,10 +53,23 @@
|
||||||
(let ((env (if (null? _env) *global-environment* (car _env))))
|
(let ((env (if (null? _env) *global-environment* (car _env))))
|
||||||
(eval (wrapc exp) env)))
|
(eval (wrapc exp) env)))
|
||||||
|
|
||||||
|
;; Expressions received from C code are already evaluated, but sometimes too much so.
|
||||||
|
;; Try to wrap
|
||||||
(define (wrapc exp)
|
(define (wrapc exp)
|
||||||
(cond
|
(cond
|
||||||
((symbol? exp)
|
((application? exp)
|
||||||
`(quote ,exp))
|
(cond
|
||||||
|
((compound-procedure? (car exp))
|
||||||
|
(cons
|
||||||
|
(car exp)
|
||||||
|
(map
|
||||||
|
(lambda (e)
|
||||||
|
(if (self-evaluating? e)
|
||||||
|
e
|
||||||
|
`(quote ,e)))
|
||||||
|
(cdr exp))))
|
||||||
|
(else
|
||||||
|
exp)))
|
||||||
(else
|
(else
|
||||||
exp)))
|
exp)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue