Comparison of programming languages (functional programming)
From Infogalactic: the planetary knowledge core
Lua error in package.lua at line 80: module 'strict' not found. Lua error in package.lua at line 80: module 'strict' not found.
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.
Contents
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
<templatestyles src="Reflist/styles.css" />
Cite error: Invalid <references>
tag; parameter "group" is allowed only.
<references />
, or <references group="..." />
<templatestyles src="Asbox/styles.css"></templatestyles>