HCoop
/
jackhill
/
mal.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e4d7c6a
)
Allow specifying initial set of bindings while creating new environment
author
Iqbal Ansari
<iqbalansari02@yahoo.com>
Wed, 17 Aug 2016 18:31:59 +0000
(
00:01
+0530)
committer
Iqbal Ansari
<iqbalansari02@yahoo.com>
Sat, 27 Aug 2016 12:43:33 +0000
(18:13 +0530)
common_lisp/env.lisp
patch
|
blob
|
blame
|
history
diff --git
a/common_lisp/env.lisp
b/common_lisp/env.lisp
index
238ce16
..
880bab5
100644
(file)
--- a/
common_lisp/env.lisp
+++ b/
common_lisp/env.lisp
@@
-50,3
+50,17
@@
(defmethod set-env ((env mal-environment) symbol value)
(setf (gethash symbol (mal-env-bindings env)) value))
+
+(defmethod initialize-instance :after ((env mal-environment)
+ &key (bindings nil)
+ (parent nil)
+ (binds nil)
+ (exprs nil))
+ (let ((arg-params (loop
+ for x in binds
+ for y in exprs
+ collect (cons x y))))
+ (dolist (arg-param arg-params)
+ (set-env env
+ (car arg-param)
+ (cdr arg-param)))))