hiljusti / fib

A Fibonacci CLI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fib

fib v1.1.2

USAGE:
  fib
  fib <N>...
  fib --until N

Calculate members of the Fibonacci sequence.

Every N provided as an argument will return a line with the Nth member
of the Fibonacci sequence. When no arguments are provided, the program
instead reads lines from standard input. Arguments (or lines from
standard input) should be non-negative integer values.

This CLI considers a 0-indexed sequence, where the 0th number is 0,
the 1st is 1, then 1, 2, 3, 5, 8...

When '--until N' is used, all members of the sequence are printed on
N+1 consecutive lines, including and ending with the Nth number of the
sequence.

This project lives at https://github.com/hiljusti/fib

Requirements

Notes

  • Uses gutenberg-fibonaccis for the first 1001 numbers. (Not including zero)
  • Uses fibonacci when calculating larger fibonacci numbers.
  • Uses the classic zipWith technique when calculating large ranges of numbers.

Installation through Stack

cd $(mktemp -d) # Or wherever you prefer
git clone https://github.com/hiljusti/fib.git
cd ./fib
stack test && stack install

About

A Fibonacci CLI

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Haskell 98.8%Language:Shell 1.2%