5 Medic by Example

This section covers several small examples to help to learn the syntax of the Medic language and the use of the Medic debugging tool. Each example contains a source program and a medic program. Assuming that the source program, src.rkt, is the entry point of the program, that the medic program is src-medic.rkt, and that the source program, medic program, and program-starting script are stored in the same directory, we can start debugging by the following program-starting script:
#lang racket
(require medic/core)
(medic "src-medic.rkt")
(debug "src.rkt")

We can also run program-starting scripts in the console window of the DrRacket programming environment. To best locate the files, complete paths of programs—depending on the stored location—should be supplied.

(require medic/core)

(medic "/home/xiangqi/medic/demos/src-medic.rkt")

(debug "/home/xiangqi/medic/demos/src.rkt")

The following are the demos:

    5.1 Demo 1: border-expr and at-expr

    5.2 Demo 2: at-expr

    5.3 Demo 3: multiple functions scope

    5.4 Demo 4: with-behavior

    5.5 Demo 5: def, import and export