<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I have been playing with FrTime and I like it. However, I have a question.<div>How do I enforce sequential evaluation?</div><div><br></div><div>In the following code the procedurer count-down doesn't behave as </div><div>expected.</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><span class="Apple-style-span" style="font-family: 'Andale Mono'; ">;;; Definitions window</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; ">(define elapsed (new-cell 0))</span><br><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; ">(define (tick) </span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; "> (- seconds </span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; "> (value-now seconds)))</span><br><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; ">(define (start-timer direction)</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; "> (set-cell! elapsed (direction (value-now elapsed)</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; "> (tick))))</span><br><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; ">(define (stop-timer)</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; "> (set-cell! elapsed (value-now elapsed)))</span><br><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; ">(define (get-timer)</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; "> elapsed)</span><br><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; ">(define reset-timer</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; "> (case-lambda</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; "> [(v) (set-cell! elapsed v)]</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; "> [() (set-cell! elapsed 0)]))</span><br><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; ">(define (count-down v)</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; "> (reset-timer v)</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; "> (start-timer -))</span><br><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; ">(define (trigger-alarm)</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; "> (when (= 0 elapsed)</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; "> (stop-timer)</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; "> "wake-up"))</span><br><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; ">;; Interactions window</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; ">> (get-timer)</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; ">0</span><br><span class="Apple-style-span" style="font-family: 'Andale Mono'; ">> (count-down 10)</span></blockquote><div><font class="Apple-style-span" face="'Andale Mono'"><div><br></div><div><span class="Apple-style-span" style="font-family: Helvetica; ">This starts counting down from 0, when I expected to count down from 10.</span></div><div><font class="Apple-style-span" face="Helvetica"><br></font></div><div><font class="Apple-style-span" face="Helvetica">Thanks,</font></div><div><font class="Apple-style-span" face="Helvetica"><br></font></div><div><font class="Apple-style-span" face="Helvetica">Jaime</font></div></font></div></body></html>