Skip to content

Instantly share code, notes, and snippets.

@domgetter
Last active June 10, 2016 17:15
Show Gist options
  • Save domgetter/97c2410a5b8e63d6ad91883d992770b2 to your computer and use it in GitHub Desktop.
Save domgetter/97c2410a5b8e63d6ad91883d992770b2 to your computer and use it in GitHub Desktop.
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