mostly-adequate-guide README

The project's README from github.com/MostlyAdequate/mostly-adequate-guide. As one markdown file: README.md.

cover

About this book

This is a book on the functional paradigm in general. We'll use the world's most popular functional programming language: JavaScript. Some may feel this is a poor choice as it's against the grain of the current culture which, at the moment, feels predominately imperative. However, I believe it is the best way to learn FP for several reasons:

That said, typed functional languages will, without a doubt, be the best place to code in the style presented by this book. JavaScript will be our means of learning a paradigm, where you apply it is up to you. Luckily, the interfaces are mathematical and, as such, ubiquitous. You'll find yourself at home with Swiftz, Scalaz, Haskell, PureScript, and other mathematically inclined environments.

Read it Online

For a best reading experience, read it online via Gitbook.

Play Around with Code

To make the training efficient and not get too bored while I am telling you another story, make sure to play around with the concepts introduced in this book. Some can be tricky to catch at first and are better understood by getting your hands dirty. All functions and algebraic data-structures presented in the book are gathered in the appendixes. The corresponding code is also available as an npm module:

$ npm i @mostly-adequate/support

Alternatively, exercises of each chapter are runnable and can be completed in your editor! For example, complete the exercise_*.js in exercises/ch04 and then run:

$ npm run ch04

Download it

Find pre-generated PDF and EPUB as build artifacts of the latest release.

Do it yourself

⚠️ This project setup is now a bit old and thus, you may run into various issues when building this locally. We recommend to use node v10.22.1 and the latest version of Calibre if possible.

About the nodejs version

As the recommended node version (v10.22.1) is a bit old now, is more than likely that you do not have it installed on your system. You can have multiple versions of nodejs installed on your system using nvm. Refer to that project to install it and then you will be able to:

nvm install 10.22.1
nvm install 20.2.0
nvm use 10.22.1
node -v // will show v10.22.1 
nvm use 20.2.0
node -v // will show v20.2.0

As this project has a .nvmrc file you can call nvm install and nvm use without specifying the node version:

// being anywhere inside this project
nvm install
node -v // will show v10.22.1

Complete sequence of commands

Considering the above about having nvm installed on your system, here is the complete sequence of commands to generate pdf and epub files by yourself:

git clone https://github.com/MostlyAdequate/mostly-adequate-guide.git
cd mostly-adequate-guide/
nvm install
npm install
npm run setup
npm run generate-pdf
npm run generate-epub

Note! To generate the ebook version you will need to install ebook-convert. Installation instructions.

Table of Contents

See SUMMARY.md

Contributing

See CONTRIBUTING.md

Translations

See TRANSLATIONS.md

FAQ

See FAQ.md

Plans for the future


Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

mostly-adequate-guide (MostlyAdequate/mostly-adequate-guide)

Searching Database…

What is this?'Mostly Adequate Guide to FP' is a free book that teaches functional programming concepts using JavaScript, going from pure functions and composition up through functors, monads and other categorical ideas.
Is this a coding library or just a book I read?It's primarily a book you read chapter by chapter online, as PDF or as EPUB, but the code snippets are also packaged as an npm module, and each chapter has a runnable exercise.js file you can solve in your own editor.
How do I start reading it?The easiest path is reading it online via GitBook, which adds a sidebar, in-browser exercises and examples; if you want an offline copy, pre-built PDF and EPUB files are attached to the latest GitHub release.
Is building the book locally painless?Not really — the build setup is outdated, so you're likely to hit issues unless you install the specific old Node version and have Calibre's ebook-convert tool ready.
How is the book structured?It has three parts: Part 1 (chapters 1-7) covers basics like pure functions, currying and composition; Part 2 (chapters 8-13) covers type classes such as functors and monads through to traversable; Part 3 (chapter 14+) tackles comonads, f-algebras, free monads and other categorical constructs.
Why did the author use JavaScript instead of a purer FP language like Haskell?Because most readers already use JS daily, so they can practice FP on real-world code instead of toy projects, while JS is flexible enough to let beginners fall back on familiar imperative habits while they learn.
Can I actually practice along as I read?Yes — every chapter has a runnable exercise.js file (e.g. exercises/ch04) you complete in your own editor and then run to check your work.
Is the content finished or still evolving?Part 1 is described as an initial draft still being corrected, and Parts 2 and 3 are listed as future plans, so the book keeps growing and changing over time.
Size
5.3 MB
Stars
23.8K
Age
11y
Commits · 90 Days