I read through most of the Racket Guide and decided to write a simple guessing game to test my understanding of Racket. It works for the most part, but once the user guesses the correct answer, I get this error message: application: not a procedure; expected a procedure that can be applied to arguments given: #<void>
Here is my code:
#lang racket
(let ([my-num (random 100)])
(display "I'm thinking of a number between 1 and 100. Please enter your guess below.\n")
(define (next-round num-rounds)
(define guess (string->number (read-line)))
(cond
[(< guess my-num) (
(display "Too low, try again!\n")
(next-round (+ num-rounds 1)))]
[(> guess my-num) (
(display "Too high, try again!\n")
(next-round (+ num-rounds 1)))]
[else (display (string-append "You guessed it in " (number->string num-rounds) " guesses!"))]))
(next-round 1))