1 Star 0 Fork 1

张传本 / fpinscala

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
sbt
Loading...
README
MIT

Join the chat at https://gitter.im/fpinscala/fpinscala

This repository contains exercises, hints, and answers for the book Functional Programming in Scala. Along with the book itself, it's the closest you'll get to having your own private functional programming tutor without actually having one.

There are two main branches in this repository:

Be sure to select the branch which matches the edition of the book you are reading!

Here's how to use this repository:

Each chapter in the book develops a fully working library of functions and data types, built up through a series of exercises and example code given in the book text. The shell of this working library and exercise stubs live in exercises/src/main/scala/fpinscala/<chapter-description>, where <chapter-description> is a package name that corresponds to the chapter title (see below). When you begin working on a chapter, we recommend you open the exercise file(s) for that chapter, and when you encounter exercises, implement them in the exercises file and make sure they work.

If you get stuck on an exercise, let's say exercise 4 in the chapter, you can find hints in answerkey/<chapter-description>/04.hint.txt (if no hints are available for a problem, the file will just have a single '-' as its contents) and the answer along with an explanation of the answer and any variations in answerkey/<chapter-description>/04.answer.scala or 04.answer.markdown. The finished Scala modules, with all answers for each chapter live in answers/src/main/scala/fpinscala/<chapter-description>. Please feel free to submit pull requests for alternate answers, improved hints, and so on, so we can make this repo the very best resource for people working through the book.

Chapter descriptions:

  • Chapter 2: gettingstarted
  • Chapter 3: datastructures
  • Chapter 4: errorhandling
  • Chapter 5: laziness
  • Chapter 6: state
  • Chapter 7: parallelism
  • Chapter 8: testing
  • Chapter 9: parsing
  • Chapter 10: monoids
  • Chapter 11: monads
  • Chapter 12: applicative
  • Chapter 13: iomonad
  • Chapter 14: localeffects
  • Chapter 15: streamingio

To build the code for the first time, if on windows:

$ .\sbt.cmd

If on mac/linux, first make sure you have not checked out the code onto an encrypted file system, otherwise you will get compile errors regarding too long file names (one solution is to put the fpinscala repo on a unencrypted usb key, and symlink it into your preferred code location).

$ chmod a+x ./sbt
$ ./sbt

This will download and launch sbt, a build tool for Scala. Once it is finished downloading, you'll get a prompt from which you can issue commands to build and interact with your code. Try the following:

> project exercises
> compile

This switches to the exercises project, where your code lives, and compiles the code. You can also do:

> console

to get a Scala REPL with access to your exercises, and

> run

To get a menu of possible main methods to execute.

To create project files for the eclipse IDE you can install the sbteclipse sbt plugin. This makes a new command available in sbt:

> eclipse

All code in this repository is MIT-licensed. See the LICENSE file for details.

Have fun, and good luck! Also be sure to check out the community wiki for the chapter notes, links to more reading, and more.

Paul and Rúnar

Copyright (c) 2012, Manning Publications, Co. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
Scala 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Scala
1
https://gitee.com/chuanben/fpinscala.git
git@gitee.com:chuanben/fpinscala.git
chuanben
fpinscala
fpinscala
first-edition

搜索帮助