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

map apply identity lambda lambda filter fold sum
Python map(func, list) func(*arguments) lambda x: x lambda x: ... filter(func, list) functools.reduce(func, list) sum(list)
Mathematica Map[func, list] or func /@ list Apply[func, args] or func @@ args #& ... # ... & Select[list, func] Fold[func, initval, list] Plus

Numerical operations on lists

sort max min
Python sorted(...) max(...) min(...)
Mathematica Sort[...] Max[...] Min[...]

Iterations on lists

group by
Python itertools.groupby(list, func)
Mathematica GroupBy[list, func][1]

Generating lists by combinatorics tools

Generate range (lazily) Infinite range (lazily)
Python xrange(start, end) itertools.count(start, step)

References


This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.