reset password
Author Message
rabbott
Posts: 1649
Posted 17:23 Oct 16, 2015 |

If you want to run your code and see what it produces without typing the prompts, paste the following at the end of the .rkt file.

(define-namespace-anchor a)
(define ns (namespace-anchor->namespace a))

(define (run exprs)
  (for/list ([expr exprs])
    (display (format "> ~a\n" expr))
    (let {[result (eval expr ns)]}
      (unless (equal? result (void)) (display result)))
    (display "\n"))
  (void))

We used this to run your Lab 2 code.  Here is a sample script. The script can follow the preceding code. It will run when the file loads when you click the Run button.

(run '((start 1 100)
       (bigger)
       (bigger)
       (correct)
       (start 3 3)
       (smaller)
       (correct)
       (start 3 300)
       (correct)
       (history)))

Last edited by rabbott at 17:37 Oct 16, 2015.