Giter VIP home page Giter VIP logo

advent-of-code-2020's Introduction

advent-of-code-2020

Rešitve Advent of Code 2020 v OCaml-u

Pri reševanju uporabljam še knjižnico Base https://opensource.janestreet.com/base/.

Template

open Base
open Stdio

(* Nastavitve *)

let dan_naloge = "1"

(* Naloge *)

let naloga1 (vsebina : string list) : string =
  "42"

let naloga2 (vsebina : string list) : string =
  "92"

(* Pomožne funkcije *)

let preberi_datoteko (ime_datoteke : string) : string list =
  let vsebina = In_channel.read_lines ime_datoteke in
  vsebina

let izpisi_datoteko (ime_datoteke : string) (vsebina : string) =
  Out_channel.write_all ime_datoteke ~data:vsebina

let ime_vhodne_datoteke dan = "day_" ^ dan ^ ".in"

let ime_izhodne_datoteke dan naloga = "day_" ^ dan ^ "_" ^ naloga ^ ".out"

(* Main *)

let _ =
  (* Preberi podatke *)
  let vsebina_datoteke = preberi_datoteko (ime_vhodne_datoteke dan_naloge) in
  (* Izračunaj rešitev *)
  let odgovor1 = naloga1 vsebina_datoteke in
  let odgovor2 = naloga2 vsebina_datoteke in
  (* Izpiši podatke *)
  izpisi_datoteko (ime_izhodne_datoteke dan_naloge "1") odgovor1;
  izpisi_datoteko (ime_izhodne_datoteke dan_naloge "2") odgovor2

Nastavitev razvijalskega okolja

Repository uporabla VSCode Docker container za delovanje, zato mora Docker biti zagnan v ozadju vedno, ko urejamo kodo.

  1. Namesti Docker na svoj računalnik. link
  2. Namesti VSCode extension link
  3. Za uporabo odpri projekt v VSCode in zaženite ukaz (ctrl + shift + P) Remote-Containers: Rebuild and Reopen in Container.

Prvi zagon traja nekaj časa, saj mora naložiti celotno sliko, vsi naslednji zagoni pa so hitri.

Pogosta vprašanja

Če kaj ni jasno naredi issue v tem repozitoriju.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.