Skip to content

Instantly share code, notes, and snippets.

@domgetter

domgetter/definitions.txt

Last active Jun 10, 2016
Embed
What would you like to do?
Programming Definitions
Set: Unordered list of unique elements.
Array: Ordered list of elements.
HashMap: Unordered list of key-value pairs where the keys are unique.
(Note: this has many different names.
Hash in Ruby, Perl
Dictionary in Python (keys must be immutable)
Object in Javascript (value functions can introspect)
Map in Clojure
HashMap in Java
Associative Array in PHP,Perl,Wikipedia
Key-Value Store in document databases
Record in C, databases
Binding: Explicit list of variables and the values they represent. (sometimes ordered)
e.x. {a: 3, b: "Jim"}
Function: Named list of instructions which takes a binding and returns a value
function add (x, y) {
// name-^^^ ^^^^-binding
return x + y;
// value-^^^^^
}
Predicate Function: A function which returns true or false
Arity: Number of parameters of a function
Reduction Function: A function which combines a value into an aggregate
e.x. (fn [total n] (+ total n))
(fn [coll elem] (conj coll elem))
Higher-order function: A function which takes a function as a parameter or returns a function as a result
e.x.
function do(f, x) {
// ^-takes a function
return f(x);
}
do(Math.sqrt, 3); // would return Math.sqrt(3)
function adder(x) {
return function (y) { return x + y; };
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-returns function
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment