Skip to content

Commit

Permalink
Issue #537 - Add useful comments
Browse files Browse the repository at this point in the history
  • Loading branch information
justinethier committed May 22, 2024
1 parent 1ce4979 commit 0621963
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scheme/eval.sld
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,19 @@
((analyze exp *global-environment* rename-env '()) *global-environment*)
((analyze exp (car env) rename-env '()) (car env))))

;; Called from the C runtime to support apply
(define (eval-from-c exp . _env)
(let ((env (if (null? _env) *global-environment* (car _env))))
(eval (wrapc exp) env)))

;; Expressions received from C code are already evaluated, but sometimes too much so.
;; Try to wrap
;; Helper function for eval-from-c
;;
;; Expressions received from C code are already evaluated,
;; however any quoted expressions will have the quotes
;; stripped off. This is a problem for expressions that
;; aren't self evaluating - like (1 2) - so we re-quote
;; the expressions here so a subsequent eval will work.
;;
(define (wrapc exp)
(cond
((application? exp)
Expand Down

0 comments on commit 0621963

Please sign in to comment.