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
import java.io.*; | |
public interface Printer { | |
public void print(PrintStream stream); | |
} | |
public class ChainPrinter implements Printer { | |
private final char _c; | |
private final Printer _next; | |
public ChainPrinter(char c, Printer next) { |
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
import java.io.*; | |
public abstract class Printer { | |
protected final PrintStream _stream; | |
public Printer(PrintStream stream) { | |
_stream = stream; | |
} | |
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 20: Pulse Propagation. | |
// Convert input file into dot format for rendering with graphviz. | |
// dotnet fsi dotify.fsx <inputfile> <outputfile?> | |
open System | |
open System.IO | |
type Node = | |
| Broadcaster | |
| FlipFlop |
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 19: Aplenty | |
// dotnet fsi aoc19.fsx | |
open System | |
open System.IO | |
open System.Text.RegularExpressions | |
type Part = { | |
x : int | |
m : int |
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 18: Lavaduct Lagoon | |
// dotnet fsi aoc18.fsx | |
open System | |
open System.IO | |
type Direction = U | D | L | R | |
type Pos = { x : int64; y : int64 } |
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 17: Clumsy Crucible | |
// dotnet fsi aoc17.fsx | |
open System | |
open System.IO | |
open System.Collections.Generic | |
module Array2D = | |
let getRowCount (ary : 'a[,]) = ary.GetLength(0) | |
let getColumnCount (ary : 'a[,]) = ary.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
// Advent of Code 2023. Day 16: The Floor Will Be Lava | |
// dotnet fsi aoc16.fsx | |
open System | |
open System.IO | |
type Dir = N | W | S | E | |
module Array2D = | |
let getRowCount (ary : 'a[,]) = ary.GetLength(0) |
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 15: Lens Library | |
// dotnet fsi aoc15.fsx | |
open System.IO | |
let readText fileName = | |
let text = File.ReadAllText fileName | |
text.TrimEnd() | |
let getHash s = |
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 15: Lens Library | |
// dotnet fsi aoc15.fsx | |
open System.IO | |
type Op = | |
| Insert of (string * int) | |
| Remove of string | |
let readText fileName = |
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 | |
module Array2D = | |
let getRowCount (ary : 'a[,]) = ary.GetLength(0) |
NewerOlder