--- /dev/null
+bin\r
+obj
\ No newline at end of file
--- /dev/null
+{\r
+ // Use IntelliSense to learn about possible attributes.\r
+ // Hover to view descriptions of existing attributes.\r
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\r
+ "version": "0.2.0",\r
+ "configurations": [\r
+ {\r
+ "name": ".NET Core Launch (console)",\r
+ "type": "coreclr",\r
+ "request": "launch",\r
+ "preLaunchTask": "build",\r
+ "program": "${workspaceFolder}/bin/Debug/netcoreapp2.1/AdventOfCode2018.dll",\r
+ "args": [],\r
+ "cwd": "${workspaceFolder}",\r
+ "console": "internalConsole",\r
+ "stopAtEntry": false,\r
+ "internalConsoleOptions": "openOnSessionStart"\r
+ },\r
+ {\r
+ "name": ".NET Core Attach",\r
+ "type": "coreclr",\r
+ "request": "attach",\r
+ "processId": "${command:pickProcess}"\r
+ }\r
+ ]\r
+}
\ No newline at end of file
--- /dev/null
+{
+ // See https://go.microsoft.com/fwlink/?LinkId=733558
+ // for the documentation about the tasks.json format
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "label": "build",
+ "command": "dotnet build",
+ "type": "shell",
+ "group": "build",
+ "presentation": {
+ "reveal": "silent"
+ },
+ "problemMatcher": "$msCompile"
+ }
+ ]
+}
\ No newline at end of file
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">\r
+\r
+ <PropertyGroup>\r
+ <OutputType>Exe</OutputType>\r
+ <TargetFramework>netcoreapp2.1</TargetFramework>\r
+ </PropertyGroup>\r
+\r
+ <ItemGroup>\r
+ <Compile Include="Day01.fs" />\r
+ <Compile Include="Program.fs" />\r
+\r
+ <Content Include="Data\day01.input">\r
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\r
+ </Content>\r
+ </ItemGroup>\r
+\r
+</Project>\r
--- /dev/null
+module AdventOfCode2018.Day01\r
+\r
+let readDigit d = int d - int '0'\r
+\r
+let parseInput (str : string) : string = str\r
--- /dev/null
+module AdventOfCode2018.Main\r
+\r
+open System\r
+open System.IO\r
+\r
+let day01 () =\r
+ let input = File.ReadAllText "Data/day01.input" |> Day01.parseInput\r
+ input\r
+\r
+let days : (unit -> string) array =\r
+ [|\r
+ day01\r
+ |]\r
+\r
+let doDay (n : int) =\r
+ if n < 1 then\r
+ ArgumentException "day number must be greater or equal to 1" |> raise\r
+ elif n > days.Length then\r
+ NotImplementedException (sprintf "no implementation for day %i" n) |> raise\r
+ else\r
+ let sw = Diagnostics.Stopwatch ()\r
+ sw.Start ()\r
+ let result = days.[n - 1] ()\r
+ printfn "Result of day %i: %s (time : %i ms)" n result sw.ElapsedMilliseconds\r
+\r
+[<EntryPoint>]\r
+let main argv =\r
+ printfn "https://adventofcode.com/2018"\r
+\r
+ if argv.Length > 0 then\r
+ doDay (int argv.[0])\r
+ else\r
+ for d = 1 to days.Length do\r
+ doDay d\r
+\r
+ Console.Read () |> ignore\r
+ 0\r
--- /dev/null
+module AdventOfCode2018.Tests\r
+\r
+open System\r
+\r
+open Xunit\r
+open Xunit.Abstractions\r
+open Swensen.Unquote\r
+\r
+open AdventOfCode2018\r
+\r
+type ``Day01 tests`` (output : ITestOutputHelper) =\r
+\r
+ [<Fact>]\r
+ let ``(Part1) My test`` () =\r
+ 1 =! 2\r
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">\r
+\r
+ <PropertyGroup>\r
+ <TargetFramework>netcoreapp2.1</TargetFramework>\r
+ <IsPackable>false</IsPackable>\r
+ </PropertyGroup>\r
+\r
+ <ItemGroup>\r
+ <Compile Include="Day01 tests.fs" />\r
+ </ItemGroup>\r
+\r
+ <ItemGroup>\r
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />\r
+ <PackageReference Include="Unquote" Version="4.0.0" />\r
+ <PackageReference Include="xunit" Version="2.4.0" />\r
+ <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />\r
+ </ItemGroup>\r
+\r
+ <ItemGroup>\r
+ <ProjectReference Include="..\AdventOfCode2018.fsproj" />\r
+ </ItemGroup>\r
+\r
+</Project>\r