Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #29166

Re: Functional programming - Professor Frisby's Mostly Adequate Guide

From Stefan Weiss <krewecherl@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Functional programming - Professor Frisby's Mostly Adequate Guide
Date 2016-01-07 19:05 +0100
Organization albasani.net
Message-ID <n6m9ce$5he$1@news.albasani.net> (permalink)
References <28cf4382-ffa5-4935-8d6b-cbb07284cf13@googlegroups.com> <893daf06-da3e-4da8-b25e-7479d93cb95c@googlegroups.com>

Show all headers | View raw


On 01/07/2016 17:44, Michael Haufe (TNO) wrote:

> Scott Sauyet was walking down the same path.

And now he's part of the book :)

| Exercises
|
| A quick word before we start. We'll use a library called ramda which
| curries every function by default.

<https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch4.html>

See https://www.npmjs.com/~crosseye

> In regards to the referenced book, I'm not certain I'm a fan of its
> approach. It assumes far too much of the reader.

Yeah, it could definitely use some editing. For example, a function
named "reduce" is used without introduction or explanation in an example
that looks rather hard to figure out for beginners:

  var head = function(x) { return x[0]; };
  var reverse = reduce(function(acc, x){ return [x].concat(acc); }, []);
  var last = compose(head, reverse);

  last(['jumpkick', 'roundhouse', 'uppercut']);
  //=> 'uppercut'

There is also pseudocode that looks like JavaScript, but isn't. At least
not with the results it claims:

  // associativity
  var associative = compose(f, compose(g, h)) ==
    compose(compose(f, g), h);
  // true

The two resulting functions will be equivalent, but they're not the same
function, so `==` will result in `false` instead.

Then again, this is the first book I've seen that tries to teach FP
using only JavaScript. It looks interesting enough that I'll probably
read the rest of it when I can find the time. I don't mind reading
between the lines a little or looking up features I'm not familiar with.

- stefan

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Functional programming - Professor Frisby's Mostly Adequate Guide beegee <bgulian@gmail.com> - 2016-01-06 07:35 -0800
  Re: Functional programming - Professor Frisby's Mostly Adequate Guide "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-07 08:44 -0800
    Re: Functional programming - Professor Frisby's Mostly Adequate Guide Stefan Weiss <krewecherl@gmail.com> - 2016-01-07 19:05 +0100
      Re: Functional programming - Professor Frisby's Mostly Adequate Guide Scott Sauyet <scott.sauyet@gmail.com> - 2016-01-18 12:10 -0800

csiph-web