diff --git a/api/api.lisp b/api/api.lisp index 81b28c5..5157eda 100644 --- a/api/api.lisp +++ b/api/api.lisp @@ -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 @@ -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))))) (built-in-unary (destructuring-bind (arg) rest (let ((result (ecase head diff --git a/api/package.lisp b/api/package.lisp index 8761980..c4a9543 100644 --- a/api/package.lisp +++ b/api/package.lisp @@ -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)) diff --git a/lurk-lib b/lurk-lib index 994dc42..4c69391 160000 --- a/lurk-lib +++ b/lurk-lib @@ -1 +1 @@ -Subproject commit 994dc42f259d51ddf67ebe0382dd964ffd270840 +Subproject commit 4c69391626e745376ef404da74fb7126666d8af5