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

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
主站蜘蛛池模板: 宜君县| 麻阳| 锡林浩特市| 江口县| 颍上县| 玉树县| 宿州市| 长武县| 白城市| 平武县| 延边| 方正县| 年辖:市辖区| 岳阳市| 平邑县| 宝鸡市| 翼城县| 应城市| 德保县| 吴忠市| 遵化市| 桓台县| 新蔡县| 临湘市| 耒阳市| 大悟县| 江津市| 昭通市| 灵武市| 昆山市| 安图县| 固始县| 鱼台县| 东阿县| 崇义县| 平原县| 辽宁省| 涿州市| 庆阳市| 无棣县| 土默特左旗|