3 ms·
Do these terms (“subscript”, “projection”) have a deeper meaning - maybe from another discipline - or are these terms arbitrarily chosen to explain the abstrac
by hcarvalhoalves 3y ago
Do these terms (“subscript”, “projection”) have a deeper meaning - maybe from another discipline - or are these terms arbitrarily chosen to explain the abstractions of the language?
- fanf2 3y ago“Projection” is often used in functional programming to mean a function that picks a value out of a tuple, e.g. `fst (x,y)` returns x (the first element of the tuple) which is like projecting a vector onto an axis.
- gpderetta 3y agoProjection is also a similar (but more general) operation in relational algebra (i.e. SELECT in SQL).
- ufogigf 3y agoVery straightforwardly: the two terms come from mathematics. "Subscripts are often used to refer to members of a mathematical sequence or set or elements of a vector. For example, in the sequence O = (45, −2, 800), O₃ refers to the third member of sequence O, which is 800." (Wikipedia) As fanf2 said, projection in software typically refers to selecting one element of a tuple. "[Projection is] An operation typified by the jth projection map, written projⱼ, that takes an element x = (x₁, ..., x ⱼ , ..., xₙ) of the Cartesian product X₁ × ⋯ × Xⱼ × ⋯ × Xₙ to the value projⱼ(x) = xⱼ" https://en.wikipedia.org/wiki/Projection_(mathematics) https://en.wikipedia.org/wiki/Projection_(mathematics)
- sanxiyn 3y agoThey are meant to be evocative, but it is best to consider them as arbitrary tokens. There is no close analog in other languages.