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

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
主站蜘蛛池模板: 栾城县| 东乡族自治县| 高台县| 五莲县| 奉贤区| 赫章县| 图片| 沁阳市| 张家川| 读书| 哈尔滨市| 盐津县| 岑巩县| 宣武区| 吉林市| 渭源县| 永川市| 锡林郭勒盟| 临颍县| 图片| 潼南县| 准格尔旗| 兴安县| 曲阳县| 财经| 台东市| 凌云县| 思茅市| 祁门县| 思茅市| 巴林右旗| 北碚区| 吕梁市| 安陆市| 莱州市| 宜州市| 长寿区| 阿勒泰市| 枝江市| 娄底市| 湄潭县|