Skip to content
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

Merged

Conversation

ZachOBrien
Copy link
Contributor

Suggestion from the Racketcon hackathon

(between/c -1 1))]))

(define (recip x) (/ 1 x))
(define (non-zero? x) (not (= x 0)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps (zero? x)?

Copy link
Contributor

@jessealama jessealama Oct 28, 2022

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) ...).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good suggestion

@sorawee
Copy link
Collaborator

sorawee commented Oct 28, 2022

I'd suggest using @examples. See recontract-out for an example.

@ZachOBrien
Copy link
Contributor Author

ZachOBrien commented Oct 28, 2022

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.

@ZachOBrien ZachOBrien force-pushed the racketcon-hackathon-contract-out-example branch from 6ad3a41 to 300fe1a Compare February 12, 2023 02:17
@bennn bennn merged commit 425630d into racket:master Feb 12, 2023
@ZachOBrien ZachOBrien deleted the racketcon-hackathon-contract-out-example branch February 12, 2023 22:02
kiranandcode pushed a commit to verse-lab/NUS-Racket that referenced this pull request Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants