Product
type alias Person =
# generate 100 random integers and store them in a file | |
STORE = "numbers.txt" | |
unless File.exists?(STORE) | |
File.write(STORE, 100.times.map { Random.rand(10) }.join("\n")) | |
end | |
numbers = File.read(STORE).split("\n").map { |n| n.to_i } |
pub fn part_one(input: &str) -> Option<(Vec<Coords>, usize)> { | |
let board = Board::from(input); | |
run_dijkstra( | |
&[board.start], | |
|node| board.successors(node), | |
|node| node == &board.end, | |
) | |
} |
{ }: | |
let | |
sources = import nix/sources.nix { }; | |
pkgs = import sources.nixpkgs { }; | |
darwinInputs = with pkgs; | |
lib.optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ | |
AppKit | |
CoreFoundation |
let | |
sources = import ./nix/sources.nix { }; | |
nixpkgs = import sources.nixpkgs { }; | |
nixpkgs-ruby267 = import sources.nixpkgs-ruby267 { }; | |
in nixpkgs.mkShell { | |
buildInputs = [ | |
nixpkgs.go | |
nixpkgs-ruby267.ruby_2_6 | |
]; | |
} |
module MonadTrans where | |
import Control.Applicative (empty) | |
import Control.Monad (guard, join) | |
import Control.Monad.Trans.Class (lift) | |
import Control.Monad.Trans.Identity (IdentityT (..), runIdentityT) | |
import Control.Monad.Trans.Maybe (MaybeT (..)) | |
import Control.Monad.Trans.Reader (Reader, ReaderT (..), ask) | |
import Data.List (intercalate) | |
import qualified Data.Map.Lazy as M |
module Robot where | |
robot (name, attack, hp) = \message -> message (name, attack, hp) | |
name (n, _, _) = n | |
attack (_, a, _) = a | |
hp (_, _, hp) = hp |
A formal system for expressing computation in terms of function abstraction and application using variable binding and substitution
Invented in the 1930s by Alonzo Church. He was pals with Turing. Unsurprisingly, any problem which can be solved with a Turing machine can be solved with lambda calculus. Check out the aptly named Church-Turing thesis!
f(1) = A
module Main exposing (main) | |
import Html exposing (Html, text) | |
type Distance a | |
= Distance Float | |
type Kilometer |