LispCookbook / LispCookbook/cl-cookbook

Misleading information in section "Rational types"

Open Beginner friendly
#467 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
158
Avg merge
6d 3h
Merged PRs (30d)
2

Description

https://github.com/LispCookbook/cl-cookbook/blob/fd22cd81b5e9f29d1c65e51d80a568e897552dad/numbers.md#L71-L82

The type bignum is specified to be exactly (and integer (not fixnum)), which, along with the first line of this paragraph, would then mean that 1/2 is not a valid ratio because neither 1 and 2 are bignums.

I'd rather say something similar to the specification: that numerator and denominator are both integers, their GCD is 1, and numerator must be greater than 1.

I'd also mention that the conversion between ratio and integer is automatic so the programmer doesn't need to worry about overflows or underflows or imprecise computation, but also means that it's easily possible to reach bignum arithmetic and therefore get computation that is slower and consing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open numbers.md and inspect the "Rational types" section at the linked lines. Revise the description to state the integer, coprime numerator and denominator requirements, then add the requested explanation of automatic ratio/integer conversion and its possible bignum performance and consing costs. Done means the section is accurate and no longer implies that 1/2 is invalid.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.