[Openmcl-devel] compute values in place
Pascal J. Bourguignon
pjb at informatimago.com
Sun Sep 30 02:38:46 PDT 2012
Taoufik Dachraoui <dachraoui.taoufik at gmail.com> writes:
> is it possible to have something like this:
>
> (let ((a '(#1=expr #1#))
> (setmemloc (getmemloc (car a)) (eval (car a))))
So it's Sunday, brains are sleeping…
What do you think
> (let* ((form '#1=(+ 1 2))
> (nv (eval form))
> (sexp '(#1# 3 #1# #(4 #1# #(5 #1# 6) #1#))))
> (values (mapcar (lambda (g.s) (funcall (cdr g.s) nv))
> (find-all-places sexp form))
> sexp))
is?
(defun getmemloc (sexp form)
(find-all-places sexp form))
(defun setmemloc (places new-value)
(mapcar (lambda (g.s) (funcall (cdr g.s) new-value)) places))
(let ((a '(#1=(+ 1 2) 3 #1# #(4 #1# #(5 #1# 6) #1#))))
(setmemloc (getmemloc a (car a)) (eval (car a)))
a)
--> (3 3 3 #(4 3 #(5 3 6) 3))
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
More information about the Openmcl-devel
mailing list