Skip to content

Instantly share code, notes, and snippets.

View aktowns's full-sized avatar
👾

Ashley Towns aktowns

👾
View GitHub Profile
@praeclarum
praeclarum / AlgorithmW.fs
Last active February 2, 2025 14:29
Algorithm W - or Hindley-Milner polymorphic type inference - in F#
module AlgorithmW
// HINDLEY-MILNER TYPE INFERENCE
// Based on http://catamorph.de/documents/AlgorithmW.pdf
// (Now at http://web.archive.org/web/20170704013532/http://catamorph.de/documents/AlgorithmW.pdf)
type Lit =
| LInt of int
| LBool of bool
@nkpart
nkpart / fmap.md
Last active December 5, 2024 05:31
fmap . fmap . fmap

fmap . fmap . fmap

Functors and Traversables compose.

You might have seen this statement before. This is how you can take advantage of it.

Composing many fmap calls gives you a function that will drill down into a structure and modify it at a certain depth in that nested structure.

@staltz
staltz / introrx.md
Last active May 15, 2025 10:37
The introduction to Reactive Programming you've been missing
;; aktowns's solution to Count a Sequence
;; https://4clojure.com/problem/22
(fn [x] (reduce #(+ %1 %2) (map (fn [_] 1) x)))