Solutions to problems from Advent of Code 2019.
- Java 8
- Clojure 1.10.1
- Leiningen 2.9.3 (optional)
Java 8 can be installed via SDKMan, which is a version manager for technologies related to the Java Virtual Machine (similar to rbenv
for Ruby or pyenv
for Python).
$ sdk install java 8.0.242.hs-adpt
$ export JAVA_HOME=~/.sdkman/candidates/java/current
Visit the official web site to get the instructions according to your operating system.
Visit the official web site to get the instructions according to your operating system.
$ cd /path/to/repo
$ lein repl
Once the repl has started, change the namespace for the one you are interested in.
For example, to play around with the day-1.spacecraft
namespace, run:
advent-of-code=> (in-ns 'day-1.spacecraft)
#object[clojure.lang.Namespace 0x7725cd39 "day-1.spacecraft"]
day-1.spacecraft=> (fuel-required module-masses)
4959709
$ lein test
$ cd /path/to/repo
$ clj
Clojure 1.10.1
user=>
Once the repl has started, load the advent_of_code.clj
file, that requires the namespaces
of all days. It is like a facade to those namespaces to avoid loading each file. Then change the current
namespace for the one you are interested in.
For example, to play around with the day-1.spacecraft
namespace, run:
user=> (load-file "src/main/clojure/advent_of_code.clj")
nil
user=> (in-ns 'day-1.spacecraft)
#object[clojure.lang.Namespace 0x7725cd39 "day-1.spacecraft"]
day-1.spacecraft=> (fuel-required module-masses)
4959709
$ clj -Atest