From Imperative to Functional: how to make the leap.
Many programmers find functional programming difficult, if not downright cryptic. This is because functional programming is not merely about relinquishing the assignment statement and using closures liberally. It’s a whole different mindset. …basically boils down to three things: For this tutorial, I won’t be using the syntax of any particular programming language. That would obscure my point. Instead, I will borrow from high school mathematics. Here is an example: Which means, “let n be a natural number whose value is 42. More generally, when I say I mean that x has type T. Basically x is an element of the set T (let’s just assume that types are sets). And when I say I just mean that x is the value denoted by the expression Expr. Now let’s define a function: Which means “Let f be a function from natural numbers to real numbers, which returns its input plus π”. To make reading easier, we will use this more familiar syntax whenever possible: I will however insist on using type annotatio
March 2013 From Imperative to Functional: how to make the leap Many programmers find functional programming difficult, if not downright cryptic. This is because functional programming is not merely about relinquishing the assignment statement and using closures liberally. It’s a whole different mindset . The functional mindset …basically boils down to three things: Your program isn’t about what it does, but about what things are. Your code isn’t just a linear sequence of instructions, but a tree of nested expressions. Functions are ordinary mathematical objects, just like an integer is. Some n
Explore this link on the map →related reading
- An introduction to functional programmingcodewords.recurse.com
- A practical introduction to functional programmingmaryrosecook.com
- how I think when I think about programming - alice mazalicemaz.com
- What’s so great about functional programming anyway?jrsinclair.com
- f# - What are advantages and disadvantages of "point free" style in functional programming? - Stack Overflowstackoverflow.com
- Learnable Programmingworrydream.com
- Imperative vs Declarative Programmingui.dev
- Things unlearnedscattered-thoughts.net
- adventures in uncertainty: An Introduction to Recursion Schemesblog.sumtypeofway.com
- Reading 13: Map, Filter, Reduceweb.mit.edu
- Functional Programming HOWTO — Python 3.14.6 documentationdocs.python.org
- 1.2. OCaml · Functional Programming in OCamlcourses.cs.cornell.edu