This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2023. Day 14: Parabolic Reflector Dish | |
// dotnet fsi aoc14.fsx | |
open System | |
open System.IO | |
let readLines = | |
File.ReadAllLines >> Array.filter ((<>) String.Empty) | |
let rollNorthStep (s1, s2) = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2023. Day 13: Point of Incidence | |
// dotnet fsi aoc13.fsx | |
open System | |
open System.IO | |
let readChunks fileName = | |
let text = File.ReadAllText fileName | |
text.TrimEnd().Split("\n\n") |> Array.toList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2023. Day 12: Hot Springs | |
// dotnet fsi aoc12.fsx | |
open System | |
open System.IO | |
let parseLine (s : string) = | |
let parts = s.Split(" ") | |
let springs = parts[0] | |
let damaged = parts[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2023. Day 11: Cosmic Expansion | |
// dotnet fsi aoc11.fsx | |
open System | |
open System.IO | |
let readLines = | |
File.ReadAllLines >> Array.filter ((<>) String.Empty) | |
let findEmptyRows rows = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2023. Day 10: Pipe Maze | |
// dotnet fsi aoc10.fsx | |
open System | |
open System.IO | |
module Array2D = | |
let tryGet (a : 'a[,]) index1 index2 = | |
let first = index1 >= 0 && index1 < a.GetLength(0) | |
let second = index2 >= 0 && index2 < a.GetLength(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Tailor; | |
using System.Collections; | |
using System.Collections.Generic; | |
public static class EnumerableExt | |
{ | |
public static IEnumerable<T> Tail<T>(this IEnumerable<T> source) | |
{ | |
return new TailEnumerable<T>(source); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2023. Day 9: Mirage Maintenance | |
// dotnet fsi aoc09.fsx | |
open System | |
open System.IO | |
let parseLine (s : string) = | |
s.Split(" ") |> Array.toList |> List.map int64 | |
let differences = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2023. Day 8: Haunted Wasteland | |
// dotnet fsi aoc08.fsx | |
open System | |
open System.IO | |
let parse (s : string) = | |
let a = s.Substring(0, 3) | |
let b = s.Substring(7, 3) | |
let c = s.Substring(12, 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="html.js"></script> | |
<script> | |
function rotateRight(arr) { | |
arr.unshift(arr.pop()); | |
} | |
function rotateLeft(arr) { | |
arr.push(arr.shift()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2023. Day 7: Camel Cards | |
// dotnet fsi aoc07.fsx | |
open System | |
open System.IO | |
let parseLine (line : string) = | |
match line.Split(" ") with | |
| [|card;bid|] -> (card, int bid) | |
| _ -> failwith "Wrong" |