about summary refs log tree commit diff stats
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/combinators.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/js/combinators.js b/js/combinators.js
new file mode 100644
index 0000000..98ba205
--- /dev/null
+++ b/js/combinators.js
@@ -0,0 +1,31 @@
+/*
+identity		I	a → a
+constant		K	a → b → a
+apply			A	(a → b) → a → b
+thrush			T	a → (a → b) → b
+duplication		W	(a → a → b) → a → b
+flip			C	(a → b → c) → b → a → c
+compose			B	(b → c) → (a → b) → a → c
+substitution 	S	(a → b → c) → (a → b) → a → c
+chain			S_³	(a → b → c) → (b → a) → b → c
+converge		S2³	(b → c → d) → (a → b) → (a → c) → a → d
+psi				P	(b → b → c) → (a → b) → a → a → c
+fix-point4		Y	(a → a) → a
+*/
+
+const I  = x => x
+const K  = x => y => x
+const A  = f => x => f (x)
+const T  = x => f => f (x)
+const W  = f => x => f (x) (x)
+const C  = f => y => x => f (x) (y)
+const B  = f => g => x => f (g (x))
+const S  = f => g => x => f (x) (g (x))
+const S_ = f => g => x => f (g (x)) (x)
+const S2 = f => g => h => x => f (g (x)) (h (x))
+const P  = f => g => x => y => f (g (x)) (g (y))
+const Y  = f => (g => g (g)) (g => f (x => g (g) (x)))
+
+// see also
+// https://ramdajs.com/
+// https://sanctuary.js.org/
\ No newline at end of file