Weitere ähnliche Inhalte
Ähnlich wie Programação Funcional: Novos Horizontes para a Expansão da Consciência (20)
Programação Funcional: Novos Horizontes para a Expansão da Consciência
- 47. “JavaScript is the first lambda language to go mainstream” JavaScript: The Good Parts, Douglas Crockford
- 53. Funçõesem JS function reduce(f, a, i) { varres = i; for (iin a) res = f(res, a[i]); return res; } reduce(function (s, x) { return s + x }, [4, 5, 10, 8, 12, 2, 1, 9], 0) > 51
- 54. Disponívelem um JavaScript próximo de você vara = [4, 5, 10, 8, 12, 2, 1, 9]; a.filter(function (x) { return x > 5 }) > [10, 8, 12, 9] a.reduce(function (s, x) { returns+x }) > 51
- 61. Mônadasem JS functionCookie(val) { // armazena dado em um cookie } Cookie.prototype.ret = function (v) { returnnew Cookie(v); } Cookie.prototype.bind = function(f) { returnnew Cookie( f(this.get()) ); }
- 66. “once you get the hang of it, functional programming is really fun” JavaScript: The Good Parts, Douglas Crockford