Chapter 5

Functional Programming in Scheme

A functional programming language gives a simple model of programming: one value, the result, is computed on the basis of others, the inputs.

— Simon Thompson, Haskell: The Craft of Functional Programming (2007)

The spirit of Lisp hacking can be expressed in two sentences. Programming should be fun. Programs should be beautiful.

—Paul Graham, ANSI Common Lisp (1996)

[L]earning Lisp will teach you more than just a new language—it will teach you new and more powerful ways of thinking about programs.

—Paul Graham, ANSI Common Lisp (1996)

A minute to learn . . . A lifetime to master.

—Slogan for the game Othello

FUNCTIONAL programs operate by returning values rather than modifying variables—which is how imperative programs work. In other words, expressions (all of which return a value) rather than statements are used to affect computation. There are few statements in functional programs, if any. As a result, there are few or no side effects in functional programs—of course, there is I/O—so bugs have only a local effect. In this chapter, we study functional programming in the context of the Scheme programming language.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.117.75