Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

begin1 #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions api/api.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@
`(api:eval ,@(mapcar #'macro-expand rest)))
((eql api:begin)
`(api:begin ,@(mapcar #'macro-expand rest)))
((eql api:begin1)
`(api:begin1 ,@(mapcar #'macro-expand rest)))
(built-in-unary
(destructuring-bind (arg) rest
(case head
Expand Down Expand Up @@ -310,6 +312,14 @@
;; specifically eval the rest with the new ram,
;; but NOT the new env
(eval-expr-for-p p `(api:begin ,@(cdr rest)) env new-ram))))
((eql api:begin1)
(if (null (cdr rest))
(eval-expr (car rest) env)
(multiple-value-bind (val ignored-env ram)
(eval-expr (car rest) env)
(multiple-value-bind (ignored-val env ram)
(eval-expr-for-p p `(api:begin ,@(cdr rest)) env ram)
(values val env ram)))))
porcuquine marked this conversation as resolved.
Show resolved Hide resolved
(built-in-unary
(destructuring-bind (arg) rest
(let ((result (ecase head
Expand Down
4 changes: 2 additions & 2 deletions api/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
(:use :common-lisp)
;; QUOTE and NIL are not shadowed, to ease list syntax handling.
(:shadow #:atom #:car #:cdr #:cons #:eq #:eval #:if #:lambda #:t #:+ #:- #:* #:/ #:=)
(:export #:atom #:begin #:car #:cdr #:cons #:current-env #:emit #:eq #:eval #:if #:lambda #:let #:letrec #:macroexpand #:nil #:quote
(:export #:atom #:begin #:begin1 #:car #:cdr #:cons #:current-env #:emit #:eq #:eval #:if #:lambda #:let #:letrec #:macroexpand #:nil #:quote
#:t #:+ #:- #:* #:/ #:=))

(defpackage lurk.api.ram
(:nicknames :api.ram)
(:use :common-lisp :lurk.api)
(:shadowing-import-from :lurk.api #:atom #:car #:cdr #:cons #:defmacro #:eq #:eval #:if #:lambda #:macroexpand #:t #:+ #:- #:* #:/ #:=)
(:export #:atom #:car #:cdr #:cons #:current-env #:current-ram #:define #:defmacro #:eq #:eval #:if #:lambda #:macroexpand #:let #:letrec #:nil #:quote
(:export #:atom #:begin #:begin1 #:car #:cdr #:cons #:current-env #:current-ram #:define #:defmacro #:eq #:eval #:if #:lambda #:macroexpand #:let #:letrec #:nil #:quote
#:t #:+ #:- #:* #:/ #:=
#:quasi #:uq #:uqs))

Expand Down
2 changes: 1 addition & 1 deletion lurk-lib