All commands are run inside nix-shell.
There are two days which were not yet available in Nix: Day07 and Day09.
Build executable (build.sh):
gplc --no-top-level day01.pl
Run: ./day01
Run interpreter and compile code on start:
gprolog --init-goal '[day01]'
Run interpreter, compile code and execute main fn:
gprolog --init-goal '[day01]' --query-goal 'main'"
Testing (both sample and real data):
gprolog --init-goal '[day01]'
| ?- mainA('sample.txt', A).
| ?- mainB('input.txt', A).
| ?- main.TODO: replace hack with catch to read numbers from file in a better way.
Run main fn:
idris2 -x main day02.idr
Build program:
./build.sh
Run program:
./run.sh
Interactive repl:
./repl.sh
Execute fn interactively:
:exec main
Import module:
:module Data.Strings
Run sample: ./samle.sh
Run main: ./run.sh
or manually:
gforth day03.fs`
samle
main
bye
Test: ./tests.sh or gforth day03.fs tests.fs -e bye
Interactive repl:
gforth day03.fs
sample
or
gforth
s" day03.fs" included \ to load the file manually
sample
To exit hit: Ctrl+D.
Space Related applications of Forth
Run: ./build.sh
After building, run: ./day04_dats
Run: nix-shell --run 'myatscc experiments.dats' && ./experiments_dats
./build.sh
./run.sh
After building, run:
nix-shell --run 'time ./out/Aoc2020-Day05-Carp'
./build.sh
./test.sh
./run.sh
After building, run:
nix-shell --run 'time ./_build/default/bin/aoc_day_six'
./build.sh
./run.sh
After building, run:
bash -c 'time ./day07'
Run Lisp REPL:
sbcl --load day08.lisp
Inside after changes:
(load "day08.lisp")
(load "tests.lisp")
./run.sh
bash -c 'time sbcl --script day08.lisp'
Source Chapel in bash if you installed it locally (or use Docker instead):
source /path/to/chapel/util/quickstart/setchplenv.bash
chpl -o day09 day09.chpl
Docker:
docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp chapel/chapel:1.23.0 chpl --static -o day09docker day09.chpl
./day09
bash -c 'time ./day09'
./build.sh
./day10
bash -c 'time ./day10'
./build.sh
./day11
or build & run in one step:
dmd -run day11.d
bash -c 'time ./day11'
./day12.pl
bash -c 'time ./day12.pl'
lein repl
cider-connect
C-c C-k - Load buffer to Cider
Run (-main) in Cider
lein uberjar
lein run
In 2020/day13 folder:
nix-shell --run 'java -jar target/uberjar/day13-1.0-standalone.jar'
./run.sh
bash -c 'time lua ./day14.lua'
raco exe --gui day15.rkt
./test.sh
raco test day15.rkt
./run.sh
racket day15.rkt
bash -c 'time racket ./day15.rkt
ucm -C .
cd aoc2020.day16
fork .base lib.base
run main
compile main day16.uc
Runs automatically on every save inside UCM.
bash -c 'time ucm run.compiled day16.uc'
crystal build --progress --release day17.cr
crystal run day17.cr
crystal run day17.cr
bash -c 'time ./run.sh'
kotlinc day18.kt -include-runtime -d day18.jar
java -jar day18.jar
bash -c 'time java -jar day18.jar'
nim c day19.nim
Optimized version:
nim c -d:release -x:off --opt:speed day19.nim
nim c -r day19.nim
bash -c './day19'
zig build-exe day20.zig
zig build-exe -O ReleaseFast day20.zig
zig run day20.zig
zig run --watch day20.zig
zig test day20.zig
zig fmt day20.zig
bash -c 'time ./day20'
How to define String Set:
module StrSet = Set.M(String)
type strSet = StrSet.t
ocamlfind ocamlopt -linkpkg -package base -package stdio day21.ml -o day21
dune build day21.exe
utop
#require "base";;
dune exec ./day21.exe
dune fmt
bash -c 'time ./day21'
dart compile exe day22.dart
dart run day22.dart
bash -c 'time ./day22.exe'
swift day23.swift
bash -c 'time swift day23.swift'
julia day24.jl
julia -i day24.jl
bash -c 'time julia day24.jl
elm-test
This will run inside the test and print result.