Functional Programming

Usage

Avoid nested loops with different counter variables
Avoid repetitive functions with similar effects, like changing HP or MP stats in an RPG
Avoid unneccessary indexing and iterating through complex data structures
Avoid losing sight of the goal within the clutter of the algorithm
Avoid writing unreadable and inflexible code
Avoid loop counter variables by using iterators and generators
Avoid global or application scope variables
Avoid creating variables that are only used once
Avoid looping through collections of return variables by using callbacks
Avoid side-effects and infinite loops

References

General

Map Function
Functional Programming
Higher-Order Function
Anonymous Function
Monad Tutorial

JavaScript

Functional Programming in Ruby and Javascript
Higher Order Map Implementations in JavaScript
Javascript Closures for Dummies
Lazy Function Definition Pattern
Enhanced Javascript Lazy Function Definition Pattern/
Higher-Order Programming in JavaScript
Higher-Order JavaScript
The Little Javascripter
Use Functional Programming for Simpler JavaScript
Functional Fun with Dojo

Ruby

Some Useful Closures in Ruby
Currying in Ruby
Closures and Higher-Order Functions
Collection Closure Method
Closures in Ruby
An Introduction to Closures in Ruby
Higher-Order Ruby

Python

Functional Python Library
Closures in Python
Emulating Ruby Blocks in Python
Multi-Line Lambdas using the with Command

Perl

Specializing Functions with Currying
Functional Programming in Perl
Pissed off about Functional Programming

PHP

PHP as a Lambda Language
Map and Reduce in PHP

TrackBack URI

Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.