How to evaluate code with function definitions in scribble

Hi folks,

I can't get an example to evaluate when it has define in it. I've tried lots of stuff. The example in the scribble documentation works, but that uses typed racket. I don't want to use typed racket:

@examples[#:eval my-evaluator
          (define (positive-integer? x)
            (and (positive? x)
                 (integer? x)))]

Earlier I tried:

@examples[#:eval my-evaluator
          (define (positive-integer? x)
            (and (positive? x)
                 (integer? x)))
          (positive-integer? 42)]

DrRacket says "examples: exception raised in example
error: "define: function definitions are not allowed in the interactions window; they must be in the definitions window""

Thanks for your help.

I would guess that your my-evaluator is configured to run a student language (e.g. Beginning Student Language), which prohibits definitions in the REPL. Maybe try the regular Racket evaluator? E.g. just the plain (make-base-eval).

Oh good on ya, perfect guess.

Thanks mate.