Skip to content

Instantly share code, notes, and snippets.

@matthewhammer
matthewhammer / CBPV_and_partial_application.md
Last active October 19, 2023 13:01
CBPV: Different Types for Partial/Full Application

CBPV: Different Types for Partial/Full Application

Instead of using call-by-value (CBV), I often use Call-by-push-value (CBPV) in my core calculi, and many people ask me "why?".

Most reasons relate to the "fine-grained" typed structure that it introduces, and the ability of this structure to describe "low-level" concerns, like the difference between partial and full function application (of curried,

@matthewhammer
matthewhammer / ledger.did
Created May 18, 2021 22:27 — forked from ninegua/ledger.did
Internet computer ledger utility supporting 2 step transfer (separate sign and send)
type ICPTs = record {
e8s : nat64;
};
type Duration = record {
secs: nat64;
nanos: nat32;
};
type TimeStamp = record {
@matthewhammer
matthewhammer / RecClassFunc.mo
Created July 26, 2021 15:51
Recursively `class`-`func` definitions in Motoko.
// Recursion via "manual back-patching"
//
// What?
// MyClass is defined recursively with myFunc, which refer to each other.
//
// How?
// The myClass method uses a variable for mutable storage (myClass_) to
// determine if the initialization has occured yet or not.
class Test() {
@matthewhammer
matthewhammer / cs-colloquium-reqs.md
Last active July 28, 2018 18:04
CS Colloquium, Request Instructions
@matthewhammer
matthewhammer / Hammer-writing-preferences.Md
Last active April 11, 2018 16:20
Matthew Hammer's writing preferences and guidelines (a reference for students and collaborators)

Matt's Writing Preferences

Below, I am cataloging my writing preferences.

Many of these guidelines simply codify well-established principles for clear, concise technical writing. Some guidelines are specific to me, and others are suggestions that are especially important for reading really wide columns of text, as in this new PACMPL format. :)

@matthewhammer
matthewhammer / Hazel_prototype_comments.md
Last active March 5, 2018 13:20
Comments on Hazel prototype, somewhat "organized"

2018.03.05

Nested contexts

2018-3-5-screenshot

Nested contexts (e.g., nested lets) give rise to nested hole contexts. The current Hazel interface displays paths through this nested structure, with clickable links, which is very cool.

This makes we wonder:

@matthewhammer
matthewhammer / Time_with_random_points.elm
Last active February 1, 2018 19:38
Time with random points
import Html exposing (Html, div, text)
import Time exposing (Time, second)
import Random exposing (Seed)
main =
Html.program
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
@matthewhammer
matthewhammer / curating-hazel-edits.md
Last active November 20, 2017 12:44
Curating Hazel Edits

Curating Hazel Edits

How should we curate edit histories in Hazel so that we can make sense of them, and find patterns and structure in them?

Interacting with terms in Coq and Agda

Let's step back and consider related systems like Cog and Agda (both provide interactive editor services for functional programs, though these have depedent types, unlike Hazel; let's ignore dependent types). Though all of these systems have similar interaction models, Agda's way of doing things is very different from Coq, and both should be different than Hazel:

@matthewhammer
matthewhammer / DataPipesLang.txt
Created October 6, 2017 17:01
Data Pipes -- Language Definition
Types
-----------
Element types
E ::= Generate(D)
| Consume(D)
| Modify(D1, D2)
| Pair(D1,D2,D3) // D3 is a function of D1 and D2 (its the "product" of the dictionary types)
| Proj(D1,D2,D3) // D2 and D3 are each "projections" of the dictionary type D1
(* Directed graph *)
type graph
val empty : graph
val add_nd : graph -> ndid -> nddat -> (graph, option<nddat>)
val del_nd : graph -> ndid -> (graph, option<nddat>)
val dat_of_nd : graph -> ndid -> optional<nddat>
val adj_of_nd : graph -> ndid -> List<ndid>
val adj_of_nd : graph -> ndid -> (ndid -> α -> α) -> α -> α
type edgeid = (ndid, ndid)