A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/fangyi-zhou/advent-of-code-ocaml-starter below:

fangyi-zhou/advent-of-code-ocaml-starter: Starter code for doing Advent of Code in OCaml

Advent of code with OCaml
  1. Create a repository using this template
  2. Install dependencies via opam install . --deps-only
  3. Put your session cookie into .session
  4. (Optional) Put the year into .year (e.g. 2022)

For each day, first specify a type t for the parsed input, and then there are 3 functions to implement:

The functor Day.Make generates a function run to run the pipeline.

    val run : ?only_part1:bool -> ?only_part2:bool -> string -> unit

The main executable, aoc, can be invoked via

which will invoke the run function for that DAY, with input taken from inputs directory. If no input file is present, then the input file would be downloaded using your session cookie.

If you want to test your program with the small example for the day, the easiest way is to put it the example in the template file. The expectation test can be invoked with dune test, and updated with dune promote, see more in dune documentation on expectation tests.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4