-
-
Notifications
You must be signed in to change notification settings - Fork 668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Add example of contract-out #4474
docs: Add example of contract-out #4474
Conversation
(between/c -1 1))])) | ||
|
||
(define (recip x) (/ 1 x)) | ||
(define (non-zero? x) (not (= x 0))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps (zero? x)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or perhaps, using not/c
:
(and/c real? (not/c zero?))
And then you can drop (define (non-zero? x) ...)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, good suggestion
I'd suggest using |
Thanks, I'll look into examples. The contract is also incorrect, does not have to be in range [-1, 1], so I'll fix that. |
6ad3a41
to
300fe1a
Compare
Suggestion from the Racketcon hackathon