Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

set!

  • Loading branch information...
commit 8088f89d0005491d7e722ca71fd1dfb787cdcd7b 1 parent 2d39064
authored May 20, 2012
BIN  plc/stdlib/eval.bc
Binary file not shown
11  plc/stdlib/eval.lisp
@@ -73,7 +73,7 @@
73 73
                        __localset__
74 74
                      (if initial
75 75
                          __local_mkref__
76  
-                       __local_refset))))
  76
+                       __local_refset__))))
77 77
            (flat-list val op (!local-bind-index it)))
78 78
        (flat-list val (!cp-symbol-self var env) __symset__)))))
79 79
 
@@ -171,7 +171,7 @@
171 171
    (if (and (not (!env-toplevel? env))
172 172
             (pair? exp)
173 173
             (eq? (car exp) 'define))
174  
-       (!cp-inner-define (cdr exp) rest env) ; TODO:
  174
+       (!cp-inner-define (cdr exp) rest env) 
175 175
      (if (not (null? rest))
176 176
          (flat-list (compile exp env) __drop__ (!cp-begin-impl (car rest) (cdr rest) env))
177 177
        (compile exp env)))))
@@ -192,6 +192,9 @@
192 192
  (define !cp-define (lambda (var val env)
193 193
    (flat-list (compile val env) (!cp-symbol-self var env) __symset__ (!cp-undef))))
194 194
 
  195
+ (define !cp-set! (lambda (var val env)
  196
+   (flat-list (!cp-set-nopush var (compile val env) #f env) (!cp-undef))))
  197
+
195 198
  (define !cp-pair (lambda (pair env)
196 199
    (if (!env-quote? env)
197 200
        (!cp-list pair env)
@@ -207,7 +210,9 @@
207 210
                  (!cp-if (cadr pair) (caddr pair) '(undef) env)
208 211
                (!cp-if (cadr pair) (caddr pair) (cadddr pair) env)))
209 212
        ((define) (!cp-define (cadr pair) (caddr pair) env))
210  
-       ((set!)) ; TODO:
  213
+       ((set!) (let ((var (car (cdr pair)))
  214
+                     (val (cadr (cdr pair))))
  215
+                 (!cp-set! var val env)))
211 216
        ;; TODO: macro
212 217
 
213 218
        ;; etc

0 notes on commit 8088f89

Please sign in to comment.
Something went wrong with that request. Please try again.