soegaard2
2022-4-23 08:36:07

Your example reads: (define a (+ 1 b)) (define b 2) Which result do you want to it to evaluate it to?

One option: • collect all variables and declare them (but bind them to the undefined value) • assign values to the variables This handles the problem of referring to a later binding.

(require racket/undefined) (define a undefined) (define b undefined) (set! a (+ 1 b)) (set! b 2) Depending on the domain of your DSL, there could be a better default value to use.