{{ message }}

Instantly share code, notes, and snippets.

# Corey Haines coreyhaines

Last active Apr 18, 2021
View show script class
 def foo p self end p self foo
Last active Apr 19, 2020
Peano's Axioms in Prolog
View peano.pl
 % Peano's Axioms :- module(peano, [ is_zero/1, is_natural/1, equal/2, add/3, subtract/3, multiply/3, divide/3 ]).
Created Apr 19, 2020
Peano's Axioms in Prolog
View peano.pl
 % Peano's Axioms :- module(peano, [ is_zero/1, is_natural/1, equal/2, pred/2 ]). /** Peano's Axioms *
Last active Jun 19, 2019
Simple Maybe<T> approximation in typescript
View maybe.ts
 type Maybe = T | undefined; function maybeMap(mv: Maybe, f: (v:T) => U) : Maybe { if(mv !== undefined) { return f(mv); }else{ return undefined; } } function maybeBind(mv: Maybe, f: (v:T) => Maybe) : Maybe { if(mv !== undefined) {
Last active Apr 4, 2018
Convert a list of paths to a tree
View Foldit.exs
 defmodule FolditTest do use ExUnit.Case doctest Foldit def to_keyword([], keyword), do: keyword def to_keyword([val], keyword) do Keyword.update(keyword, nil, [val], fn existing -> [val | existing] end) end
Last active Jul 8, 2017
The Id type I like
View Id.elm
 type Id = Id Int idIs : Id -> { a | id : Id } -> Bool idIs thisId = idFieldIs .id thisId idFieldIs : (a -> Id) -> Id -> a -> Bool
Created Jan 27, 2017