Skip to content

Overhaul of Fibonacci<T> #126

Description

@oscbyspro

I'll take a moment to enjoy the silly things. Fibonacci<T> is one of the earliest models, but this library has evolved a lot since its introduction. As a result, I want to rework it in the following ways:

  1. Allow negative indices in Fibonacci<T> #8
  2. implement consuming and mutating methods
  3. replace throws with Optional<Self> & Bool
  4. add an unchecked index-element-next initializer
  5. add BinaryInteger.fibonacci(_:) functions

The 1st point makes it so there's only one way to fail, hence the 3rd. The 2nd point makes it easier to use, and the 3rd point essentially turns it into an iterator without actually turning it into an iterator. The 4th point lets you create an instance from a trusted source, which makes some testing strategies more viable. The the 5th point is partially to ignore errors when only the other element overflows, and partially for discoverability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    additionoh, so shiny!brrrsuch code, much wowsubtractionhuh? where did it go?

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions