<div dir="ltr">Hi<div><br></div><div>This is probably simple but I could not figure out the explanation, I hope that</div><div>someone could help me out</div><div><br></div><div>CL-USER> (defun fac (n) (if (= n 0) 1 (* n (fac (- n 1)))))</div>
<div>FAC</div><div>CL-USER> (time (fac 3))<br></div><div><div>(FAC 3)</div><div>took 0 milliseconds (0.000 seconds) to run.</div><div>During that period, and with 1 available CPU core,</div><div> 0 milliseconds (0.000 seconds) were spent in user mode</div>
<div> 0 milliseconds (0.000 seconds) were spent in system mode</div><div>6</div></div><div><br></div><div>As you can see, there is no consing when FAC is called</div><div><br></div><div>Now, knowing that pushing an element on the stack, (PUSH 1 X) is equivalent</div>
<div>to (SETQ X (CONS 1 X)), and since FAC is using a stack and thus pushing </div><div>values on the stack why there is no consing when (FAC 3) is called?</div><div><br></div><div>I believe there is a simple explanation but I could not figure it out</div>
<div><br></div><div>Kind regards</div><div>Taoufik</div><div><br></div></div>