Published
Edited
May 27, 2019
2 forks
Insert cell
Insert cell
oldI = function(a) { return a }
Insert cell
oldI(100)
Insert cell
I = a => a
Insert cell
I(100)
Insert cell
I("Abc")
Insert cell
f1 = I(I)
Insert cell
f1(100)
Insert cell
f1("string")
Insert cell
function oldAdd(a) {
return (
function(b) {
return a + b
} )
}
Insert cell
add = a => (b => a + b)
Insert cell
add(3)(12)
Insert cell
add3 = add(3) // b => 3 + b
Insert cell
add3(12)
Insert cell
(b => 3 + b + b)(12) // 3 + 12 + 12
Insert cell
w = f => f(f)
Insert cell
w(I) // I(I) = I
Insert cell
w(I)(100)
Insert cell
w(I)(125)
Insert cell
w(I)("safd")
Insert cell
w(w)
Insert cell
f2 = a => b => c => b
Insert cell
f2(1)(2)(3)
Insert cell
K = a => b => a
Insert cell
K("hello")("world")
Insert cell
K(I)("x") // (a => b => a)(I)("x")
// (b => I)("x")
// I
Insert cell
K(I)("x")("y")
Insert cell
reverseMinus = a => b => b - a
Insert cell
reverseMinus(4)(3)
Insert cell
flip = f => a => b => f(b)(a)
Insert cell
minus = flip(reverseMinus)
Insert cell
minus(4)(3)
Insert cell
TRUE = a => b => a
Insert cell
FALSE = a => b => b
Insert cell
IF = c => e1 => e2 => c(e1)(e2)
Insert cell
IF(TRUE)("hello")("nohello")
Insert cell
IF(FALSE)("hello")("nohello")
Insert cell
NOT = c => c(FALSE)(TRUE)
Insert cell
IF(NOT(FALSE))("hello")("nohello")
Insert cell
IF(NOT(TRUE))("hello")("nohello")
Insert cell
n0 = f => z => z
Insert cell
n1 = f => z => f(z)
Insert cell
n2 = f => z => f(f(z))
Insert cell
ADD1 = n => f => z => f(n(f)(z))
Insert cell
ADD1(n0)(add1)(0)
Insert cell
ADD1(n1)(add1)(0)
Insert cell
ADD = n => m => f => z => n(f)(m(f)(z))
Insert cell
ADD(n1)(n2)(add1)(0)
Insert cell
ADD(n1)(n2)(add1)(0)
Insert cell
add1 = add(1)
Insert cell
n0(add1)(0)
Insert cell
n1(add1)(0)
Insert cell
n2(add1)(0)
Insert cell
[1,2,3,4,5,6,7,8,9,10].map( x => x*10 )
Insert cell
[1,2,3,4,5,6,7,8,9,10].filter( x => x%2 === 0 );
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more