Functional Programming Languages : Examples of functional programming languages FLP

Functional programming Languages

Functional programming languages (FPL) is a language which is used by programmers doing the work of software construction by using pure functions. In present time, many companies are looking for programmer employers who can solve the problems in many ways by using Functional programming languages.

Functional programing Languages list

Programming languages are very useful for every programmer,So in my opinion every programmer must know the basic of popular functional Programing languages.Here I am explaining some popular programming languages.

1. Clojure

    Clojure - Wikipedia

Clojure was developed by Rich Hickey in 2007. It is a functional programming lan guage. It provides the tools to avoid mutable state, provides functions as first-class objects, and focus recursive iteration instead of side-effect based looping. Clojure does not focus on your program to be referentially transparent and it does not efforts for ‘provable’ programs. The philosophy behind Clojure is that most parts of most programs should be functional, and that programs that are more functional are more powerful. The Filename extensions of Clojure are .clj.cljs.cljc.edn.

2.Elixir

The Elixir programming language

Elixir was developed by Jose Valim in 2011. It is functional, general-purpose programming language that runs on the BEAM virtual machine used to implement the Erlang programming language. As we all know the Discord and Pinterest they also based on Elixir programming language. ParaDuty, Brex, Bleacher Report, The Outline and many more companies also used Elixir programming language. The Filename  extensions of Elixir are .ex, .exs.

3.Elm

Elm (programming language) - Wikipedia

Elm was developed by Evan Czaplicki in March 30, 2012. It is a domian-specific programming language for declaratively creating web browser-based graphical user interfaces. This programming language focus on usability, performance and robustness. Elm has a small set of language constructs, including traditional if-expressions, let-expressions for local state, and case-expressions for pattern matching. The Filename  extensions of Elm is .elm.

4. Erlang

Erlang (programming language) - Wikipedia

Erlang was first appeared in 1986. It is a general-purpose programming language and runtime environment. Erlang has built-in support for concurrency, distribution and fault tolerance. This is used in several large telecommunication systems from Ericsson. This is available as open source from http://www.erlang.org. OTP (Open Telecom Platform) is a large collection of libraries for Erlang to do everything from  WWW server. The Filename  extensions of Erlang is .erl, .hrl.

5. F#

F Sharp (programming language) - Wikipedia

F# was developed in 2005.It is a functional-first, general purpose, strongly typed, multi-paradigm programming language that includes functional imperative and object-orienterd programming methods. This is most often used as a cross-platform Common Language Infrastructure language on . NET, but it also generate JavaScript and graphics processing unit code. It is a fully supported language in Visual Studio. This language is mostly used for editors. The filename extensions of F# are .fs, .fsi, .fsx, .fsscript.

6. PureScript

PureScript and Haskell at Lumi. Note: This post and our new engineering… | by Phil Freeman | Lumi | Medium

PureScript was designed by Phil Freeman in 2013. It is a strong-type, purely-functional programming language that compiles to JavaScript. This language can be used in web application development, server side apps and also desktop web applications. It’s syntax is mostly comparable to that of Haskell. PureScript introduces row polymorphism and extansible records. The filename extensions of PureScript is .purs.

7. Rust

Rust Programming Language

Rust was originally designed by Graydon Hoare in 7 July 2010. It has been voted the “most loved programming language” in the Stack(Last in First out) Overflow Developer Survey. This language is designed for performance and safety. The important thing is that the Rust is syntactically simmilar to C++. But it gives guarantee memory safely by using a borrow checker to validate references. Rust achieves memory safely without garbage collection. The filename extensions of Rust are .rs, .rlib.

8. Swift

Download Swift Logo in SVG Vector or PNG File Format - Logo.wine

Development of Swift started in july 2010 by Chris Lattner, with the eventual collaboration of many other programmers at Apple. It took language ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU and many more. On 2 June 2014 the Apple Worldwide Developers Conference application become the first publicly released app written with Swift. The filename extensions of Swift are .swift, .SWIFT.

Also read : Cyber Programming : Programming Languages necessary for cyber security.

Functional programming Languages Examples

1. Clojure

(defn argcount
  ([] 0)
  ([x] 1)
  ([x y] 2)
  ([x y & more] (+ (argcount x y) (count more))))
-> #'user/argcount
(argcount)
-> 0
(argcount 1)
-> 1
(argcount 1 2)
-> 2
(argcount 1 2 3 4 5)
-> 5

2. Elixir

Program of modules.

defmodule Fun do
  def fib(0), do: 0
  def fib(1), do: 1
  def fib(n), do: fib(n-2) + fib(n-1)  
end

3. Elm

Program  of show a list of items I need to buy at the grocery store.

import Html exposing (..)

main =
div []
[ h1 [] [ text "My Grocery List" ]
, ul []
[ li [] [ text "Black Beans" ]
, li [] [ text "Limes" ]
, li [] [ text "Greek Yogurt" ]
, li [] [ text "Cilantro" ]
, li [] [ text "Honey" ]
, li [] [ text "Sweet Potatoes" ]
, li [] [ text "Cumin" ]
, li [] [ text "Chili Powder" ]
, li [] [ text "Quinoa" ]
]
]

4. Erlang

The program of print helloworld.

% hello world program
-module(helloworld). 
-export([start/0]). 

start() -> 
   io:fwrite("Hello, world!\n").

5. F#

Print helloworld using class

type Program() =   
class  
do printfn "Hello World"  
end  
new Program()

6. PureScript

Program of sum of prime.

var sumOfPrimes =
chain(_.range(1000))
filter(isPrime)
reduce(function(x, y) {
return x + y;
})
value();

7. Rust

Program of variable bindings.

fn main() {
let an_integer = 1u32;
let a_boolean = true;
let unit = ();

// copy `an_integer` into `copied_integer`
let copied_integer = an_integer;

println!("An integer: {:?}", copied_integer);
println!("A boolean: {:?}", a_boolean);
println!("Meet the unit value: {:?}", unit);

// The compiler warns about unused variable bindings; these warnings can
// be silenced by prefixing the variable name with an underscore
let _unused_variable = 3u32;

let noisy_unused_variable = 2u32;
// FIXME ^ Prefix with an underscore to suppress the warning
}

8. Swift

Write a name inside angle brackets to make a generic function or type.

func makeArray<Item>(repeating item: Item, numberOfTimes: Int) -> [Item] {
var result = [Item]()
for _ in 0..<numberOfTimes {
result.append(item)
}
return result
}
makeArray(repeating: "knock", numberOfTimes: 4)

Functional programming languages in PPL

Full form of PPL is Principle of Programming language. It includes the data structures, Syntax design, Support for abstraction, exception handling and many other features. In other hand functional programming is a way by which programmers do the work of software construction by using pure functions. So there is no relation between functional programming and principle of programing languages.

Also read : Cyber Programming : Programming Languages necessary for cyber security.

READ MORE

 

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *