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…

这是什么?《Mostly Adequate Guide to FP》是一本免费的书,使用 JavaScript 讲解函数式编程的概念,内容从纯函数和函数组合,一直讲到函子、单子以及其他范畴论相关的思想。
这是一个编程库,还是只是一本我可以读的书?它主要是一本可以逐章在线阅读的书,也提供 PDF 和 EPUB 格式;其中的代码片段还打包成了一个 npm 模块,每一章都附有一个可以运行的 exercise.js 练习文件,你可以在自己的编辑器里完成练习。
我该如何开始阅读?最简单的方式是通过 GitBook 在线阅读,它带有侧边栏,并提供可以在浏览器中直接操作的练习和示例;如果你想要离线版本,最新的 GitHub 发布版本中附有预先生成的 PDF 和 EPUB 文件。
在本地构建这本书是否很省事?并不省事——构建配置已经过时,所以除非你安装特定的旧版 Node,并提前准备好 Calibre 的 ebook-convert 工具,否则很可能会遇到各种问题。
这本书是怎样组织的?全书分为三部分:第一部分(第 1–7 章)讲解纯函数、柯里化和函数组合等基础内容;第二部分(第 8–13 章)讲解函子、单子直到可遍历结构等类型类;第三部分(第 14 章及以后)讨论余单子、f-代数、自由单子以及其他范畴论构造。
作者为什么用 JavaScript,而不是 Haskell 这类更纯粹的函数式语言?因为大多数读者平时就在使用 JS,所以他们可以在真实世界的代码上练习函数式编程,而不是玩具项目;同时 JS 足够灵活,让初学者在学习过程中还能暂时依靠熟悉的命令式写法。
我能边读边实际练习吗?可以——每一章都有一个可以运行的 exercise.js 文件(例如 exercises/ch04),你可以在自己的编辑器里完成它,然后运行以检查你的答案。
这些内容是已经完成的,还是仍在变化?第一部分被描述为仍在修正中的初稿,第二和第三部分被列为未来计划,所以这本书会随着时间不断增加和变化。
Size
5.3 MB
Stars
23.8K
Age
11y
Commits · 90 Days