Seth Lawal
Seth Lawal

Reputation: 11

What is wrong with this answer

(define inc (lambda(x)((+ x 1 ))))

I created the line of code above as an answer to the question

"Create a function called "inc" which will be given a numeric argument, and returns a number larger by one. For instance, (inc 6) => 7"

Upvotes: 0

Views: 79

Answers (1)

Andrew
Andrew

Reputation: 982

You have an extra set of parentheses. You want

(define inc (lambda(x)(+ x 1 )))

instead of

(define inc (lambda(x)((+ x 1 ))))

Upvotes: 3

Related Questions