[racket] [realm of racket] contract error with 'smaller' function
I am not sure whether this is a the right list to post this question. Else
please let me know.
I run this in Dr. racket.
#lang racket
(define lower 1)
(define upper 100)
(define (guess)
(quotient (+ lower upper) 2))
(define (smaller)
(set! upper (max lower (guess (sub1 guess))))
(guess))
When i invoke the smaller function in the repl i get:
Welcome to DrRacket, version 5.3.5--2013-06-18(-/f) [3m].
Language: racket; memory limit: 128 MB.
> (smaller)
. . sub1: contract violation
expected: number?
given: #<procedure:guess>
>
What am i doing wrong?
- Jo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20131020/75974655/attachment.html>