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

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
主站蜘蛛池模板: 周宁县| 开封县| 西乡县| 张家川| 庄河市| 宁南县| 武汉市| 浮山县| 云浮市| 德州市| 闽侯县| 邯郸市| 南充市| 大连市| 周宁县| 蕉岭县| 宁德市| 中方县| 万全县| 华蓥市| 衡水市| 安龙县| 台东县| 翁源县| 遵化市| 宜黄县| 宁远县| 开封市| 绵竹市| 措勤县| 鹤庆县| 谷城县| 桐柏县| 禹州市| 夏津县| 天门市| 阿鲁科尔沁旗| 香格里拉县| 水富县| 曲麻莱县| 丹凤县|