Print a multiplication table of prime numbers using the Sieve of Eratosthenes (see a nice visual demo there).
Git this repo:
% git clone git@github.com:MicahElliott/primetab
% cd primetab
Build:
% lein uberjar
There is a tiny wrapper script provided. Run with:
% ./primetab [options]
Run primetab --help
to see the full list of options.
The basic configurables are:
- the
n
umber of primes to print for the table - color or
b
land output raw
format to omit labels/headers for the tablec
sv ort
sv delimiters
Print a small 5x5
table, blandly without color, in CSV format.
% ./primetab -n5 -bc
Generate HTML docs:
% lein codox
See the generated codox HTML in target/default/doc/index.html
% $BROWSER target/default/doc/index.html
There is no CI or real quality control yet. :) This code relies on kibit, joker, etc to keep code clean.
You can run the suite of unit tests with:
% lein test
To also run integration tests, run:
% lein test :all
In order to test "large" primes, you may need to set JVM options (i.e., initial memory allocation pool), like:
% JVM_OPTS='-Xss1g' lein test :all
I see ~500 MB being allocated to run the integration tests.
During development, it's handy to run unit tests constantly upon changes:
% lein auto test
There are configured setups for ensuring code quality:
CodeClimate does not treat Clojure as a first-class citizen, but they
support some basic checks, like lein kibit
.
- Expand on tests for boundaries, long-running, overflows, etc
- Add some specs
- Add reloaded repl workflow via Component
Copyright © 2019 Micah Elliott / FC