[racket] Saving function bodies in Beginning Student Language
On Jun 26, 2011, at 11:01 PM, Gregory Marton wrote:
> In BSL:
>
>> (define/save-source (foo x) (+ x 3))
>> (procedure-source foo)
> (cons '? (cons (cons 'x empty) (cons (cons '+ (cons 'x (cons 3 empty))) empty)))
What you see here is the BSL printer of course. It insists on showing students the list in terms of basic construction steps.
>> (procedure-name foo)
> 'foo
>> (foo 6)
> function call: expected a defined function name or a primitive operation name after an open parenthesis, but found something else
As Eli said, in BSL, a function definition defines a macro. So your define/source needs to deliver a macro that obeys the same protocol (I am not sure that's doable via a teachpack).
;; ---
May I ask how you wish to explain the evaluation of expressions? Or how your presentation is going to differ from the stepper's?
-- Matthias