Arc Forumnew | comments | leaders | submitlogin
2 points by drcode 6011 days ago | link | parent

ooops... looks like there is a bug when mutation is attempted- I will try to fix this.

This function should return '(foo) but returns nil instead:

  (do {}
      (push 'foo ^)
      ^)
It's a shame this example doesn't work, since it shows off the elegant way you can assign a variable to 'nil by using empty curly braces :-)


2 points by drcode 6011 days ago | link

now fixed. Change ac-body to:

  (define (ac-body body env)
    (if (null? body)
      '()
      (if (and (list? (car body)) (eq? 'curly (car (car body))))
          `((let ((^ (begin ,@(ac-body (cdr (car body)) env))))
             ,@(ac-body (cdr body) (cons '^ env))))
          (cons (ac (car body) env) (ac-body (cdr body) env)))))

-----