What is Functional Programming? - Christopher Bennage. Disclaimer: I’m still pretty green with functional programming.
This is me working out my own understanding. Wikipedia defines Functional Programming (FP) this way: “functional programming is a programming paradigm that treats computations as the evaluation of mathematical functions and avoids state and mutable data.” [reference] Let’s break this apart. Programming Paradigm What’s a “programming paradigm”? It seems to me that most popular languages allow for the use of more than one paradigm.
Computations In this definition, I take the term very generically. Evaluations of Mathematical Functions This is the core concept behind functional languages. F(t) = -4.9t2 + 19.6t + 3 With this function, we pass in a value for t and we get back a value representing the height. Avoids State and Mutable Data This point follows naturally from the last one, however it was very confusing to my object-oriented mind. Characteristics of Functional Languages I’ll begin by discussing the first three items. What is Functional Programming? Part 2, Currying - Christopher Bennage. In my last post, I provided a list of concepts that I found to be characteristic of functional languages.
We’ve talked bout the first three so far. First Class Functions Higher Order Functions Pure Functions Currying or Partial Application Recursion Pattern Matching Memoization Currying Updated based on some feedback from Matthew Podwysocki. Let’s begin with the term “partial application”. In light of this, currying is the act of structuring a function so that it can be partially applied.
Ok, that’s a pretty naive definition. “[Currying] is the technique of transforming a function that takes multiple arguments in such a way that it can be called as a chain of functions each with a single argument.” - en.wikipedia.org/wiki/Currying Let’s consider an example based on these definitions. Func<int, int, int> add = (i, j) => i + j; Func<int, int, int> add = (i, j) => i + j; We can convert this into: Func<int, Func<int,int>> add_c = i => j => i + j; var sum = add(3,4); var sum = add_c(3)(4);
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) By Joel Spolsky Wednesday, October 08, 2003 Ever wonder about that mysterious Content-Type tag?
You know, the one you're supposed to put in HTML and you never quite know what it should be? Did you ever get an email from your friends in Bulgaria with the subject line "???? ?????? I've been dismayed to discover just how many software developers aren't really completely up to speed on the mysterious world of character sets, encodings, Unicode, all that stuff. But it won't. So I have an announcement to make: if you are a programmer working in 2003 and you don't know the basics of characters, character sets, encodings, and Unicode, and I catch you, I'm going to punish you by making you peel onions for 6 months in a submarine. And one more thing: In this article I'll fill you in on exactly what every working programmer should know.
A Historical Perspective The easiest way to understand this stuff is to go chronologically. And all was good, assuming you were an English speaker. Unicode Hello Encodings. Why: A Tale Of A Post-Modern Genius - Smashing Magazine. Advertisement Why the Lucky Stiff (or _Why for short) was one of the brightest and most inspiring programmers in activity.
He became famous through a series of blogs and through the incredible amount of open-source projects that he maintained over the course of more than seven years. _Why’s popularity grew along with the Ruby programming language’s popularity. When the Rails hype took off in 2005, a great number of young developers started looking to learn about Ruby, and that’s when most of them found Why’s (Poignant) Guide to Ruby, a Creative Commons book in both HTML and PDF that embodied all of its author’s characteristics: an uneasy artistic mind with a different take on what programming is all about.
Even those who didn’t happen to read the Poignant Guide could not program in Ruby without a touch of _Why’s brilliance. You may have noticed that we’re referring to _Why in the past. The disappearance has left a horde of orphans of _Why’s code and activity. Blogging Music. Katas : Hudson Software Craftsmanship. Katas and exercises for self-improvement: TDD Problems - A variety of problems from simple to hard focused on TDD Project Euler - Algorithmic and math problems Coding Dojo Kata Catalog - A wiki listing of katas Uncle Bob: Bowling Game - Bob Martin's bowling kata with Powerpoint walkthrough Uncle Bob: Prime Factors - Bob Martin's prime factors kata with Powerpoint walkthrough CodeKata - Over 20 katas from Pragmatic Programmer author Dave Thomas Video / Screencast: KataCasts.com - Recordings of katas, typically with music.