Skip to content
Prev Previous commit
Merge branch 'master' into typos
  • Loading branch information
ivenmarquardt authored Apr 15, 2020
commit 36ba07a0571b76b8d780a0524a4b8d070ac34f9c
19 changes: 17 additions & 2 deletions ch-11.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ const fold = f => acc => ([x, ...xs]) =>
? acc
: f(fold(f) (acc) (xs)) (x);

const xs = [1,2,3];
const map = f => fold(acc => x =>
arrCons_(acc) (f(x)))
([]);

const sqr = x => x * x;

const xs = [1, 2, 3];

const main = map(sqr);

Expand Down Expand Up @@ -88,7 +94,16 @@ const fold = f => acc => ([x, ...xs]) =>
? acc
: f(fold(f) (acc) (xs)) (x);

const xs = [1,2,3];
const map = f => xs => fold(acc => x =>
// ^^^^^
arrCons_(acc) (f(x)))
([])
(xs);
// ^^^^

const sqr = x => x * x;

const xs = [1, 2, 3];

const main = map(sqr);

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.