Skip to content

Why functional programming matters

September 21, 2006

Functional programming is different from imperative programming languages in one big way: they have first-class functions. Functions can be passed as arguments to functions, assigned to variables, and returned from other functions. You can also have anonymous functions which don’t even have names.

Given a language with first-class functions you can easily implement abstractions that really save you time and make your code more maintainable.

Case 1: Applying an operation to every element of a collection

Case 2: Searching for the first element that matches a condition

Case 3: Combining the elements of a collection in a single value.

Case 4: Traversing through a collection and applying an operation to each element.

Case 5: Filtering a collection based on some predicate.


From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: