Skip to content

Instantly share code, notes, and snippets.

@hansoksendahl
Last active October 20, 2022 18:09
Show Gist options
  • Save hansoksendahl/993451f8739eff8f1b5f83f26501c953 to your computer and use it in GitHub Desktop.
Save hansoksendahl/993451f8739eff8f1b5f83f26501c953 to your computer and use it in GitHub Desktop.
SKI Combinators Typescript
type S = <A, B, C>(abc: (a: A) => (b: B) => C) => (ab: (a: A) => B) => (a: A) => C
type K = <A>(a: A) => <B>(b: B) => A
/** λx.λy.λz.xz(yz) */
const s: S = a => b => c => a(c)(b(c))
/** λx.λy.x */
const k: K = a => b => a
/** λx.x */
const i = s(k)(k)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment