Computer Science theory definitions
✍️Theory
concepts
definition
stub
-
Singleton
- Restrict the instantiation of a class to one “single” instance (see the wiki article)
- This is useful when exactly one object is needed to coordinate actions across the system.
-
debounce:- it limits the rate at which a function can fire
- In
redux-sagais non-blocking.
-
idempotent: When applying a function multiple times, the state won’t change after applying it the first time.
- A function we can retry several times until it works! Yeah!
- idiomatic: Idiomatic in the context of programming can usually be defined as “the most natural way to express something in a language”
-
imperative vs. declarative
literal vs statement vs expression
literals
Representing a value within source code.
"foo"(a string)true(a boolean)- …
Not literals:
std::cout(an identifier - refer to a value in memory)foo = 0;(a statement)1+2(an expression)
Statement vs. Expression
- Statements are everything that can make up a line (or several lines) of Python code. Note that expressions are statements as well.
- Expressions can be reduced to some kind of “value”
Taken from this excellent answer concerning python.
Examples
Expressions
Something that evaluates to a value.
3 + 5function() {}because every function will return something. With no return specified, a function expression will returnundefined.yield*is an expression, not a statement — so it evaluates to a value.-
In the haskell article I read the following line:
Haskell’s
ifis an expression that must return a value, and not a statement.
Statements
JavaScript
if/elseclause andswitch/casereturnimportandexportwith
See this article from Axel Rauschmayer for more details.
Compiled vs. transpiled
Discuss on Twitter ● Improve this article: Edit on GitHub