Age | Commit message (Collapse) | Author | Files | Lines |
|
Since the `default.nix` file is specific to my tooling, I'm ignoring it.
|
|
Also delete redundant `README` from `server` directory.
|
|
Creating a simple HTTP RESTful API for exposing our `Server.semiprime`
function. It supports some help messages, primitive parsing and error handling,
and singular vs. batch processing of arguments.
For more sophisticated parsing and error-checking, I prefer to use Haskell's
Servant library.
|
|
This can be useful downstream for diagnostics.
|
|
I think it's more readable this way.
|
|
Calling `assert` within the `Enum.map` makes the errors more usable.
|
|
- Clear the boilerplate that `mix` generated
- Consume `Math.factor` to test which inputs are semiprimes
- Cache all inputs that are semiprimes as soon as we discover that they are
- semiprimes
I considered a couple things related to the Cache:
- Could save space by storing all semiprime factors in a tree. This would make
the lookups more expensive. Also because the tree's depth would never exceed
two (because all semiprimes only have two factors), the tree would be quite
broad, and we may not be saving enough space for the trade to be worthwhile. I
might be wrong about that though.
- We could consider pre-computing all semiprimes when we start the app, but
without running some tests firsts, I'm not sure whether or not it's worth the
trouble.
|
|
Since I'm often using `iex` for interactive development, these functions are
useful.
|
|
Define a simple in-memory key-value store for our cache.
TL;DR:
- Define `Cache` as a simple state-keeping `Agent`
- Define `Sup`, which starts our Cache process
- Define `App`, which starts our Supervisor process
- Whitelist `App` in `mix.exs`, so that it starts after calling `iex -S mix`
|
|
9 out of 10 doctors agree that every module needs a doc. Ask your doctor if
moduledocs are right for you!
|
|
In case I want to package this project with Nix. For now, it's useful to store
this at the project root because it help my Emacs's `project-find-file`
function.
|
|
Support `Math.factor` and cover it with tests.
|
|
I'll use as the host for utility functions needed to extend the stdlib.
|
|
Starting fresh with...
```shell
mix new server
```
|
|
This is an exciting take-home assignment because I get to write a service in
Elixir!
|