官术网_书友最值得收藏!

Chapter 2. Now Lazily Get Over It, Again

The perceived adversity of functional programming is overly exaggerated; the essence of this paradigm is to explicitly recognize and enforce the referential transparency. The previous chapter was an attempt to convince you about how amazing functional programming is; you saw some examples and read about some promised features but understandably, you are still little bit skeptical. This chapter will prepare you to delve into the F# fundamentals that we are going to utilize later.

Note

We will see how to set up the tooling for Visual Studio 2013 and for F# 3.1, the currently available version of F# at the time of writing. We will review the F# 4.0 preview features by the end of this project.

After we get the tooling sorted out, we will review some simple algorithms; starting with recursion with typical a Fibonacci sequence and Tower of Hanoi, we will perform lazy evaluation on a quick sort example. By the end of this chapter, you will be able to set up a development environment utilizing recursion as a major technique of functional algorithm designs, learn using memoization to cache intermediate results, and apply lazy evaluation in order to skip the unnecessary overhead of full execution.

In this chapter, we will cover the following topics:

  • Setting up Visual Studio and F# compiler to work together
  • Setting up the environment and running your F# programs
  • Implementing a Fibonacci sequence using recursion
  • Implementing Tower of Hanoi using recursion
  • Applying lazy evaluation for quick sort
主站蜘蛛池模板: 岐山县| 桐庐县| 壤塘县| 浪卡子县| 长武县| 徐汇区| 嘉兴市| 通榆县| 广饶县| 清远市| 招远市| 离岛区| 昔阳县| 交城县| 灵川县| 和平县| 铜山县| 赫章县| 东乌珠穆沁旗| 阿克苏市| 上思县| 永和县| 滨州市| 丰都县| 韩城市| 天台县| 新化县| 离岛区| 安西县| 册亨县| 夏津县| 壶关县| 仁化县| 梧州市| 林甸县| 仲巴县| 修水县| 台北县| 安图县| 额敏县| 视频|