casting
Last edited: August 8, 2025Pitfalls
The bytes remains the same despite copying, so you can get too funky:
int v = -12345;
unsigned int uv = v;
printf("v = %d, uv = %d\n", v, uv);
This prints “v = -12345, uv=4294954951”. As in: when you copy rvalues, the bit pattern gets copied and not the numerical number itself; so, it will overflow.
You can use U to force an signed quantity to be unsigned:
unsigned int uv = -12345U;
sign promotion
If you have the nerve of putting a comparing things of different types (don’t), then, the signed quantities gets promoted to be unsigned.
categorical grammar
Last edited: August 8, 2025categorical grammar is a grammar in the language of categories.
constituents
- \(A\), a set of “expressions”
- \(C\), a set of categories of “syntax”
- \(\varphi: A \to Pow( C)\), assigning each \(a \in A\) to a set of categories \(c \subset C\)
- \(G\): a family of sets of n-place operations where \(n=1, 2, \ldots\) (what does a “3-place” op mean? idk)
- \(R\): a set of rules encoded as tuples: \((f; \{c_1, \dots c_{k}\}; c_{k+1})\), where \(f\) is a \(k\) place operation, and \(c_{j} \in C\)
requirements
The operations of this grammar behaves like so:
Categorical Grammars Index
Last edited: August 8, 2025category
Last edited: August 8, 2025A category is an abstract collection of objects
constituents
- collection of objects, where if \(X\) is an object of \(C\) we write \(X \in C\)
- for a pair of objects \(X, Y \in C\), a set of morphisms acting upon the objects which we call the homset
additional information
requirements
- there exists the identity morphism; that is, \(\forall X \in C, \exists I_{X}: X\to X\)
- morphisms are always composable: given \(f: X\to Y\), and \(g: Y\to Z\), exists \(gf: X \to Z\)
- the identity morphism can compose in either direction: given \(f: X \to Y\), then \(f I_{x} = f = I_{y} f\)
- morphism composition is associative: \((hg)f=h(gf)\)
category theory
Last edited: August 8, 2025An abstract study of mathematics based on categories, functors, and natural transformations.