Re: References/locations

2008-08-15 Thread Clinton Ebadi
"Maciek Godek" <[EMAIL PROTECTED]> writes: > I've been thinking of implementing this "location" stuff > as a smob, but you've got the point that it is (probably) > impossible to implement the location system without > redefining set! and define. You may want to read a few documents on functional

Re: References/locations

2008-08-15 Thread Maciek Godek
Kjetil: > Well, here's a relatively clean way, I think: > > (define-macro (location name) > (define new-val (gensym)) > `(lambda (,new-val) > (set! ,name ,new-val))) > > (define old-set! set!) > > (define-macro (set! a b) > `(if (procedure? ,a) ;; Needs a better check. > (,a ,b)

Re: References/locations

2008-08-15 Thread Maciek Godek
Stephen Compall: > Actually, if you (use-syntax (ice-9 syncase)), you should be able to > define lexical symbol-macros that expand a single symbol, even in a > set! place, something like: > > (define v #(1 2 3)) > (define-syntax v1 > (lambda (stx) >(syntax-case stx () > (_ v I don't