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


Groups > comp.lang.javascript > #29327

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

Newsgroups comp.lang.javascript
Date 2016-01-18 12:10 -0800
References <28cf4382-ffa5-4935-8d6b-cbb07284cf13@googlegroups.com> <893daf06-da3e-4da8-b25e-7479d93cb95c@googlegroups.com> <n6m9ce$5he$1@news.albasani.net>
Message-ID <e4eb03d3-b354-4690-bb29-0a07ff5b3447@googlegroups.com> (permalink)
Subject Re: Functional programming - Professor Frisby's Mostly Adequate Guide
From Scott Sauyet <scott.sauyet@gmail.com>

Show all headers | View raw


Stefan Weiss wrote:
> 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>


Strands of influence are getting a bit tangled. Reg Braithwaite's 
_Javascript Allongé_ [1] was a major inspiration for the creation of 
Ramda's predecessor. Since then he's talked of using Ramda for future 
editions of the book. (He hasn't as of yet, which I think is a good 
idea.) Brian Lonsdorf, aka Dr. Boolean taught a course [2] which the 
other founder of Ramda and I attended. He was using our barely-known 
library for his course, which made us feel it was was ready for wider 
distribution. Now his book uses Ramda for many of its examples. Just 
today he became a core member of the Ramda team, and added a new side 
project to Ramda to expand our nascent Lenses implementation to deal 
with things like Prisms and Isos. 

I agree that this book still needs work. This has become a common 
publishing model: create the book in the open, accepting feedback all 
the while. I believe there is discussion of making a printed book from 
this material, but perhaps more errors will be caught up front than is 
typical with a few technical reviewers. 

On the other hand, my feeling is that this is an excellent book. I had 
been approached about writing a book about functional programming in 
Javascript, and I thought that, while _Allongé_ was excellent, and 
Michael Fogus' book [3] was reasonable, the only other book out on the 
topic (Dan Mantyla's _Functional Programming in Javascript_ [4]) was 
execrable, and so was really considering it. When the _Mostly Adequate 
Guide_ came out, I realized that I didn't need to. It was doing 
exactly what I wanted to do. So, yes, I'm mostly impressed. 


>> 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.

I'm curious as to how you'd like to see it changed. I'm so buried in 
the same world he's promoting that I have a hard time seeing such 
instances. 



> 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'

Absolutely. I'm sure he would appreciate an issue or pull request at 
the Github repostitory for the book [5]. 



> 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.

Yes, he should have some better way to distinguish pseudo-code from 
actual code, and again an issue or pull request would probably be 
appreciated. 

But there is something fundamental here too. Functional programming 
will make little distinction between these two notions. Two functions 
which always have the same results for the same inputs, really ARE the 
same function from an FP point of view. So, while this is an incorrect 
use of syntax, the underlying point is still important. 


> 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.


What I appreciate about it is perhaps exactly what some don't like. It 
doesn't try to build everything in excruciating detail with 
mind-numbing definitions. It strikes a reasonable balance between 
_how_ and _why_. 


  -- Scott


  [1]: <https://leanpub.com/javascript-allonge>
  [2]: <https://frontendmasters.com/courses/functional-javascript/>
  [3]: <http://shop.oreilly.com/product/0636920028857.do>
  [4]: <https://www.packtpub.com/web-development/functional-programming-javascript>
  [5]: <https://github.com/MostlyAdequate/mostly-adequate-guide>

Back to comp.lang.javascript | Previous | NextPrevious 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