Background

When I’ve been introduced to programming way back in high school, we started off doing Pascal. But what really made me interested with the subject was when I joined a competition, and eagerly studied C++ in a matter of weeks. So it was basically C++.

I’m actually used to the Object-oriented and imperative programming paradigms. Until I was formally introduced to Functional Programming through the Scala language back in sophomore year in college. When the course finished, i was actually at lost on where or what to do next. So I went on with the paradigm I’ve always loved. Well, I never knew I’d look back.

This post is but a review on some common functional programming methods and techniques. We are going to iterate how each essential component contributes to the whole Functional stack.

Functional Programming

Functional programming is a declarative programming paradigm, which means that programming is done with expressions. Let us expand a few major concepts of Functional Programming.

First-class and higher-order function

Higher-order functions are functions that can either take other functions as arguments or return them as results. Higher-order functions enable partial application or currying, a technique in which a function is applied to its arguments one at a time, with each application returning a new function that accepts the next argument.

Pure functions

Purely functional functions (or expressions) have no side effects. This means that pure functions have several useful properties, many of which can be used to optimize the code.

Recursion

Iteration (looping) in functional languages is usually accomplished via recursion. Recursive functions invoke themselves, allowing an operation to be performed over and over until the base case is reached.

Strict versus non-strict evaluation

Functional languages can be categorized by whether they use strict (eager) or non-strict (lazy) evaluation, concepts that refer to how function arguments are processed when an expression is being evaluated.

Type systems

Especially since the development of Hindley–Milner type inference in the 1970s, functional programming languages have tended to use typed lambda calculus, as opposed to the untyped lambda calculus used in Lisp and its variants (such as Scheme).

Know that any corrections or criticism would absolutely help me. So if you ever do have any, please feel free to comment below or tweet me at @RoselleEbarle. I am actually thanking you in advance. Have a great day, everyone!

Basically,

Basic elements are:

  • Variables in the mathematical sense (named values)
  • Functions in the mathematical sense (mapping values to values). The result of a function depends only on its arguments and the context at function definition time

Functional programming treat problems as a collection of functions. Functions perform actions.

Although none of the existing paradigms is agreed to be the best approach in developing software, nor is there any official international standard, it is actually beneficial to examine which paradigm works best for a situation. Or choose which features of a particular paradigm would be useful for the development of your software/program.

References

https://docs.python.org/2.7/howto/functional.html
http://www.cogsys.wiai.uni-bamberg.de/schmid/uoshp/lehreuos/fp01-www/fp-referate/oo-vs-fp.pdf

My name is Roselle and I’m still working on my success story. You heard that right. I’m young, I work at home on my PJs and I’m still going to make many more mistakes in life. Just like you, just like we all do. But the other thing you should know about me is that I love helping people and this blog is one of the many outlets I have in connecting with you. I talk a lot about finance, business, and personal development. Visit my About page, if you want to know more about my story!

Write A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It