3

So I have the following code block in Racket/Scheme:

(define (inc x)
  (local (define a 1)
    (+ x a)))

And when I try to run it or check syntax (in Dr. Racket) on it I get the following error:

define: bad syntax in: define

I know it's probably something really stupid, but what am I doing wrong here?

YasirA
  • 9,531
  • 2
  • 40
  • 61
alesplin
  • 1,332
  • 14
  • 23

1 Answers1

4

You need extra parentheses.

(define (inc x) (local ([define a 1]) (+ x a)))