Hi<div><br></div><div>I am writing a small interpreter for lambda calculus. Within an expression I have some shared expressions</div><div><br></div><div>The following explains my need to compute a shared expression exactly once:</div>
<div><br></div><div>(let ((a '(#1=(+ 2 3) #1#)))</div><div>   (setf (first a) (compute (first a)))</div><div>   a)</div><div><br></div><div>-> I would like to see (#1=5 #1#)  == (5 5)</div><div><br></div><div>Is there a way to compute (+ 2 3) and set the result in the same memory location of the expression</div>
<div><br></div><div>I tried the following:</div><div><br></div><div>(let ((a '(#1=(+ 2 3) #1#))) (setf (first a) (eval (first a))) a)</div><div>-> (5 (+ 2 3))</div><div><br></div><div>I want to avoid storing the expressions in a cons like:</div>
<div><br></div><div>(let ((a '(#1=(nil (+ 2 3)) #1#))) </div><div>   (setf (second (first a)) (eval (second (first a)))) a)</div><div>-> (#1=(NIL 5) #1#)</div><div><br></div><div>Kind regards</div><div>Taoufik</div>
<div><br></div>