Comparison of programming languages (functional programming)


This page provides the comparison tables of functional programming instructions between programming languages. Comparison of basic instructions of imperative paradigm is provided by the comparison of basic instructions.

List operations

Function applications and lists

For brevity, these words will be have the specified meanings in the following tables :
;funcN: A function. May be unary or n-ary.
;pred: Unary function returning a Boolean value. .
;list: The list being operated on.
;args: Comma-separated list of one or more argument names, in the form of arg1, arg2,..., argn.
;pattern: A pattern, in languages with pattern matching.
;val: Any relevant value, depending on context.


identity lambdalambdamapapplyfilterfoldsum
Pythonlambda x: xlambda args: exprmapnfuncfilterfunctools.reducesum
Mathematica#&&
Function
Map
func /@ list
Apply
nfunc@@args
SelectFoldApply
Plus@@list
C#x => x => exprEnumerable.SelectRequires reflectionEnumerable.WhereEnumerable.Aggregate
Enumerable.Aggregate
Enumerable.Sum
Enumerable.Sum
Visual Basic.NETFunction xFunction exprEnumerable.SelectRequires reflectionEnumerable.WhereEnumerable.Aggregate
Enumerable.Aggregate
Enumerable.Sum
Enumerable.Sum
F# id
fun x -> x
fun pattern -> exprSeq.map func listRequires reflectionSeq.filter pred listSeq.fold func2 val listSeq.sum list
Seq.sumBy func list

Numerical operations on lists

;comp: a binary function that returns a value indicating sort order.
sortmaxmin
Pythonsortedmaxmin
MathematicaSortMaxMin
C#Enumerable.OrderByEnumerable.MaxEnumerable.Min
Visual Basic.NETEnumerable.OrderByEnumerable.MaxEnumerable.Min
F#Seq.sort list
Seq.sortBy comp list
seq.max
seq.maxBy func list
seq.min
seq.minBy func list

Iterations on lists

group by
Pythonitertools.groupby
MathematicaGroupBy
C#Enumerable.GroupBy
Visual Basic.NETEnumerable.GroupBy
F#seq.groupBy func list

Generating lists by combinatorics tools

;start: first value of range.
;step: increment of range.
;count: number of items in range.
;last: inclusive last value of range.
;end: exclusive last value of range.
Generate range Infinite range
Pythonxrange
range
itertools.count
C#Enumerable.RangeEnumerable.Range
Visual Basic.NETEnumerable.RangeEnumerable.Range
F#seq Seq.initInfinite func