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 March 19, 2024 17:44
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 September 10, 2020 04:47
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 November 17, 2024 01:08
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)))