Skip to content

Instantly share code, notes, and snippets.

View frenchy64's full-sized avatar

Ambrose Bonnaire-Sergeant frenchy64

  • Madison, Wisconsin
View GitHub Profile
@frenchy64
frenchy64 / comp.md
Created April 27, 2015 01:55
Occurrence Typing is Compositional

Occurrence Typing is Compositional

A few months ago, Sam Tobin-Hochstadt explained to me how occurrence typing is compositional. While I had taken this for granted previously, comparing occurrence typing to other systems makes it clear that this is an important property to have.

First of all, what is occurrence typing? In dynamically typed programs, there are often type invariants enforced at program branches.

(fn [a :- (U nil String)]
  (if a
 (count a)
@frenchy64
frenchy64 / schema.md
Last active August 16, 2022 19:04
Schema generative testing

(This is a really long answer to feedback on plumatic/schema#445)

Sorry, I don't understand from here down.

My bad, there's a ton of implicit decisions and I'm only explaining the tiny details :) I'll try writing this again.

Are you basing this design off an existing language or library that I can read about to get a better understanding?

This is a combination of several ideas and tradeoffs.

@frenchy64
frenchy64 / macrovich-case.md
Last active February 22, 2022 02:45
Macrovich case explanation
(ns clojure.core.typed.test.trampoline
(:require [clojure.core.typed :as t]))
(declare funb)
(t/ann-many [Number -> (Rec [f]
(U Number [-> (U Number f)]))]
funa funb)
(defn funa [n]
(if (= n 0)
typed.clj.refactor=> (refactor-form-string "+" {})
"clojure.core/+"
typed.clj.refactor=> (refactor-form-string "(defn foo [a] (+ a 3))" {})
"(clojure.core/defn foo [a__#0] (clojure.core/+ a__#0 3))"
typed.clj.refactor=> (refactor-form-string "(defmacro foo [a] `(+ ~a 3))" {})
"(clojure.core/defmacro foo [a__#0] `(+ ~a__#0 3))"
@frenchy64
frenchy64 / hidden.md
Last active July 21, 2019 01:17
Venue: Keynote for Compose :: Melbourne, September 2nd 2019 (http://www.composeconference.org/)

The Hidden Data Flow in Types

On the surface, function types simply describe inputs and outputs—indeed, that's how they're used in most type systems. But there's more to function types!

Fascinatingly, a function type can be transformed into a data flow graph that predicts the inner workings of any function that has that type. Using this graph, intricate dependencies between function inputs and outputs can be inferred

@frenchy64
frenchy64 / README.md
Last active July 11, 2019 04:41
RFC: Animation for cljfx

RFC: Animation for cljfx

This is an initial attempt at supporting animations in cljfx. Running instructions are below.

The actual animation logic is here under the Demo comment.

The original code is here.

Running

@frenchy64
frenchy64 / notes.md
Last active July 8, 2019 18:05
Notes on JavaScript prototypes

Why Objects were successful

https://www.cs.cmu.edu/~charlie/courses/15-214/2014-fall/slides/25-history-oo.pdf

  • essense of objects is (dynamic) dispatch
  • dispatch provides interoperability
  • first-class interoperability is critical to frameworks and ecosystems
  • frameworks and ecosystems are economically critical to the software industry
  • likely a significant factor in objects' success
  • Also talks about early mistakes in Simula

Why objects are inevitable

@frenchy64
frenchy64 / Io Example Problems
Created June 25, 2019 18:23 — forked from jezen/Io Example Problems
The example problems have gone missing from the Io language website, so here’s a backup.
#Sample code
#Hello world
"Hello world!" print
#Factorial
factorial := method(n, if(n == 1, 1, n * factorial(n - 1)))
99 bottles of beer
(ns colored-lti-clj.core)
(defalias List
(TFn [a]
'{:match (All [b] [(ListVisitor a b) :-> b])}))
(defalias ListVisitor
(TFn [a b]
'{:caseNil (All [:-> b])
:caseCons (All [a (List a) :-> b])}))