We use cookies to give you the best experience possible. By continuing we’ll assume you’re on board with our cookie policy

Comparative Analysis of Four Functional Programming Languages

Introduction

Functional programming is a paradigm that treats computer programs as mathematical functions. When programming in a pure functional style, we do not manipulate states and variables (things that change value), but focus entirely on constants and functions (things that never change).

Functional programming languages are categorized into two groups, i.e. −

  • Pure Functional Languages − These types of functional languages support only the functional paradigms. For example – Haskell, Erlang, Elixir, Clojure, F# etc.
  • Impure Functional Languages − These types of functional languages support the functional paradigms and imperative style programming. For example − LISP.

Concepts of Functional Programming

  • Recursion occurs when a thing is defined in terms of itself or of its type. The most common applications of recursion is in mathematics and computer science, where a function being defined is applied within its own definition. Whis this apparently defines an infinite number of instances (function values), it is often done in such a way that no loop or infinite chain of references can occur.
  • Pure functions: Functional programs have no side effect (memory or I/O). If the result of a pure expression is not used, It can be removed without affecting other expressions. Also, if a pure function is called with arguments that causes no side-effects, the result is constant with respect to that argument list (sometimes called referential transparency), this can enable caching optimizations such as memorization.
  • Lazy Evaluation − Functional programming supports Lazy Functional Constructs like Lazy Lists, Lazy Maps, etc.
  • Supports Nested Functions − Functional programming supports Nested Functions.
  • Efficient Parallel Programming − Functional programming languages have NO Mutable state, so there are no state-change issues. One can program ‘Functions’ to work parallel as ‘instructions’. Such codes support easy reusability and testability.
  • Functional Programming also support some of the OOP popular concepts such as Abstraction, Encapsulation, Inheritance, and Polymorphism

List of Functional Programming Language

We will write a custom essay on Comparative Analysis of Four Functional Programming Languages specifically for you
for only $16.38 $13.9/page

Order now

There are various functional programming languages and they include – Common Lisp, Sheme, Clojure, wolatram language, Racket, Elang, Ocami, Haskell, F# etc.

The comparative analysis of the following functional programming languages will discussed in the following order : –

  1. Erlang programming language
  2. Haskel
  3. Common Lisp
  4. F#

Erlang Programming Language

Erlang is a general purpose, concurrency-oriented functional programming language suited for fault-tolerant, distributed, soft real-time systems . It features strong dynamic typing, lightweight concurrency, eager evaluation and prolog like pattern matching . Erlang was developed in the 1980s at the Ericsson Computer Science Laboratory to address a then-unfulfilled need for telecommunications programming: a high-level, expressive language suitable for rapid development that offered the error recovery, concurrency, distribution and performance features required by telecommunications equipment.

Erlang can be developed using Erlang/OTP (OTP stands for Open Telecommunications Platform). Erlang/OTP is distributed as free software (under the Apache Public License) . Erlang has now been adopted by companies worldwide, including Nortel and T-Mobile, Whatsapp and Facebook Chat. Erlang is used in Ericsson’s support nodes, and in GPRS, 3G and LTE mobile networks worldwide .

Haskell Programming Language

Haskell is a standardized, general-purpose purely functional programming language with strong static typing. It is named after a logician, Haskell Curry. Work began on Haskell in 1987 when a group of Committee of researchers got together to design an important language. Haskell has had various versions overtime with plans underway to launch a new version in 2020.

The compiler for Haskell is called Glasgow Haskell compiler (GHC), which is both an interpreter and native-code compile that runs on most platforms. It has been used for huge amounts of data processing, Web development, Web spiders, Testing applications, Writing system administration scripts,Backend scripts,e.tc in organizations like AT&T, Bank of America, Detexify,Google, Facebook among others.

Common Lisp Programming Language

Lisp originally invented in 1958, Lisp is the second-Oldest High-Level Language used today, Only Fortran is older, by one year and Common Lisp is the best general purpose Lisp language (dialect). It was originally created for mathematical computation, and now it is been used in Artificial Intelligence research. As one of the earliest programming languages, lisp pioneered many ideas in computer science including, high-order function, conditional, recursion in all, pattern matching etc.

F# Programming Language

F# is a general-purpose programming language for .NET (a general-purpose runtime) and for .NET’s open source counterparts. It smoothly integrates all three major programming paradigms. With F#, you can choose whichever approach works best to solve problems in the most effective way. You can do pure FP if you’re a purist, but you can easily combine functional, imperative, and object-oriented styles in the same program and exploit the strengths of each. Like other typed functional languages, F# is strongly typed but also uses inferred typing, so programmers don’t need to spend time explicitly specifying types unless an ambiguity exists.

READ:  Comparative Media Usage Patterns

Further, F# seamlessly integrates with the .NET Framework Base Class Library (BCL). Using the BCL in F# is as simple as using it in C# or Visual Basic (and maybe even simpler). F# can be used for the following: Making scientific model, Mathematical problem solving, Artificial intelligence research work, Financial modelling for advanced computation, Graphic design, Compiler Programming, Telecommunications etc.

Comparative Analysis of the Four Functional Programming Languages Using Core Evaluation Criteria

Evaluation criteria are the set of criteria that are used to evaluate different languages based on the underlying concepts of their constructs and their capabilities. There are four major evaluation criteria that will be used for this comparison . They are:

  1. Readability
  2. Writability
  3. Reliability
  4. Cost

Readability

This refers to how easily and quickly programs can be read and understood. It is generally accepted that readability plays a huge role in the maintenance of the program as an unreadable program will be difficult to maintain. Readability is defined by four mains characteristics, they include:

Overall Simplicity: This considers the number of basic constructs in a language, feature multiplicity (having more than one ways of accomplishing a particular operation) and operator overloading (how many different things can a single operator do).

A language with a large number of basic constructs is not considered simple because you will have situations where one programmer knows one subset of the constructs and another programmer knows another subset of the constructs. All the functional programming languages do not have a large number of basic constructs and so a programmer in any of them will possibly know all the possible constructs required to handle a task.

Feature multiplicity refers to when a single task can be done in multiple ways. This also affects readability.

Operator overloading occurs when a single operator symbol has more than one meaning. Although this is often useful, it can lead to reduced simplicity, especially if users are allowed to create their own overloading and are not careful with what has been done. Haskell programming language allows operator overloading by a programmer and this affects it readability as a programmer can choose to make the addition sign (+) do much more than can be understood by other programmers.

Orthogonality: This considers how to combine small set of primitive structures to build more complex data and control structures. The more orthogonal a language is, the fewer the exceptions the language rules require and this makes it easier to understand and learn. Lisp language is considered to be a highly orthogonal language because complex task can be accomplished just by combining various functions.

Data types: programming languages that have adequate facilities for defining data types and structures are considered to be readable. A programming language like Haskell has an adequate number of predefined data types and also allows a programmer to define his own data type and also define how it works.

Syntax Design: This includes the identifiers, special words and forms and meaning of the programming language. Languages that have properly defined special words and symbols are usually more readable than others. All the functional programming languages are mainly used for mathematical expressions and this makes their syntax specific to them and easy to understand.

Writability

This refers to our easily a programming language can be used to create programs for a chosen problem domain. Most of the language characteristics that affect readability also affect writability. There are several programming domains and some languages are more suitable to a domain than the other. Writability also affects the maintainability of a program as a program that is easy to write is likely to be easy to learn and understand. The functional language would function best in mathematical programs where lots of mathematical functions and equations is required. Writability is also defined by three main characteristics, which are:

Simplicity and orthogonality: These terms are explained above. But in relation to writability, the ability to combine a small number of primitive constructs and a consistent set of rules for combining them makes a programming language easy to write. F# is simple and orthogonal in this regards compared to the others, though Haskell has some level of simplicity has well because you can define a function that has various process within one line.

READ:  Sentiment analysis

Support for abstraction: This involves the ability to define subroutines and data structures. All the functional programming languages have their ways of defining abstractions but F# has better abstraction that the others.

Expressivity: This describes the breadth of ideas that can be represented and communicated in a language. The more expressive a language is, the greater the variety and quantity of ideas it can represent. The functional programming languages are not so expressive and have predefined libraries for various things.

Reliability

This is the property of performing to specifications under all conditions. In fact, this criterion is very critical because it also determines the efficiency of programs. An unreliable program is a major danger point. Reliability is expressed by three main characteristics, which are:

Type Checking: This is simply testing for type errors in a given program, either by the compiler or during program execution. Run-time type checking is expensive when compared to compile-time type checking and is more desirable. Furthermore, the earlier errors are detected in a program, the less expensive it is to make changes. Haskell does it type-checking at compile time when compared to the other languages.

Exception Handling: This is the ability of a program to intercept run time errors (as well as other unusual conditions detectable by the program), take corrective measures and then continue to run. This aids the reliability of the program. Exception handling is not properly handled in Haskell as errors can be difficult to interpret and then make corrections to.

Restricted Aliasing: Aliasing is having two or more distinct names that can be used to access the same memory cell. It is now accepted that aliasing in a programming language is a major danger and can affect the reliability of the program.

Cost

This is the property that considers how expensive or cheap a programming language is. The cost of a programming language is determined by various characteristics, which are:

Cost of the compiler/development environment: In recent times, the compiler/interpreter for most programming languages can be acquired and downloaded at no cost. Quite a number of them have their development kit included in the compiler. All the functional programming languages and their development kits are available online for free and so no cost is incurred in this regard when there’s a need to use them.

Cost of learning/teaching the language:  The functional languages highlighted in this paper all have their documentations online and would usually start their tutorials with the basics, making it easier for both new and old programmers to learn the language.

Cost of program creation, testing and use:  This is greatly dependent on the readability/writability of the programming languages. Functional programming languages usually have existing functions and libraries that can be used and this helps to make the creation process to the point of usage easy and less expensive.

Cost of maintaining the program: This deals with how expensive it will be to modify the program when changes occur in subsequent years. This at times is dependent on the number of programmers that develop in that language and then how easy or concise the program is. Functional programming languages do not have many developers and so if an organization goes the route of using it, they need to ensure that the code developed are easy to understand in case changes need to be done later.

Conclusion

This paper has given a general review of functional programming languages. It details the characteristics of these languages and also does a more detailed review of four of them. It goes on to do a comparative analysis of these four based on existing programming language evaluation criteria. More in-depth research may need to be done after a better understanding of all functional programming languages and this would help in determining the best among them.

References

  1. Armstrong, J. et al. (1996).Concurrent Programming in Erlang. Prentice-Hall.
  2. Bjarne D. (2000). Concurrent Functional Programming for Telecommunications: A Case Study of Technology Introduction. Department of Teleinformatics Computer Communication Systems Laboratory Royal Institute of Technology Stockholm, Sweden.
  3. Robert W, Sebesta (10th edition): “Concepts of Programming Languages”
  4. https://hackernoon.com/functional-programming-what-language-should-you-be-talking- 313dd8bc379b
  5. https://www.keycdn.com/blog/functional-programming/
  6. https://en.wikibooks.org/wiki/Erlang_Programming
  7. https://en.wikipedia.org/wiki/Functional_programming
  8. https://en.wikibooks.org/wiki/Haskell/Recursion
  9. Maria N. et al. (2013). Key Features and some Application Areas of Erlang Programming Language. Faculty of Mathematics and Informatics, Sofia University, 5 James Bourchier blvd., Sofia 1164, Bulgaria.
  10. https://www.cs.sfu.ca/CourseCentral/310/pwfong/Lisp/1/tutorial1.html
  11. https://en.m.wikipedia.org/wiki/Common_Lisp
  12. https://fsharp.org
  13. https://docs.microsoft.com/en-us/dotnet/fsharp
  14.  Robert Pickering ( 1st Edition ): “Beginning F# Expert Voice in .NET”

Choose Type of service

Choose writer quality

Page count

1 page 275 words

Deadline

Order Essay Writing

$13.9 Order Now
icon Get your custom essay sample
icon
Sara from Artscolumbia

Hi there, would you like to get such an essay? How about receiving a customized one?
Check it out goo.gl/Crty7Tt

Comparative Analysis of Four Functional Programming Languages
Artscolumbia
Artscolumbia
Introduction Functional programming is a paradigm that treats computer programs as mathematical functions. When programming
2021-09-13 05:08:55
Comparative Analysis of Four Functional Programming Languages
$ 13.900 2018-12-31
artscolumbia.org
In stock
Rated 5/5 based on 1 customer reviews