6 ms·
Wild and whacky idea: has anyone ever built a language with separate types for ordinal/cardinal numbers and nominal numbers? The idea would be that with nominal
by akkartik 10y ago
Wild and whacky idea: has anyone ever built a language with separate types for ordinal/cardinal numbers and nominal numbers? The idea would be that with nominal numbers you don't care about the precise result of individual calculations, just statistical properties like determinism, distribution, etc. So arithmetic on nominal numbers would be permitted to overflow, as operations are just various ways to jump from one nominal to another. However, most numbers would be ordinals/cardinals, and any overflow when generating an ordinal/cardinal would be considered an error.
https://en.wikipedia.org/wiki/Nominal_number https://en.wikipedia.org/wiki/Nominal_number
- marvy 10y agoWhat can you usefully do with a nominal number, besides input/output and comparing two of them for equality? I don't think you need language support here, library support should suffice, unless I'm missing something.
- akkartik 10y agoI was imagining that you could do everything with nominals that you normally do with integers. Arithmetic saving results in nominal numbers would just disable overflow checking. This would allow all operations involving regular numbers to double down and perform extremely strict overflow checking.
- Noseshine 10y agoThe question is (and I think was), what arithmetic do you do with numbers whose values don't matter and what concrete value they happen to have is purely accidental and arbitrary and unimportant.
- akkartik 10y agoFrom the OP, examples of intentional overflow are "..hashing, cryptography, random number generation, and finding the largest representable value for a type."
- Noseshine 10y agoWhich are not categorical variables? Those all are examples using actual numbers, meaning the values matter. > Nominal numbers or categorical numbers are numeric codes, meaning numerals used for identification only. The numerical value is in principle irrelevant, and they do not indicate quantity, rank, or any other measurement. You talked about nominal numbers up to (but excluding) this post. "nominal" means "in name only", so it's a "number", not a number. It just happens to have the same name as a number with a value.
- akkartik 10y agoYes, I'm still calling them nominal numbers, but you can give whatever name you want for "I don't care what the precise results of arithmetic are." I'll stop here because there's nothing I hate more than pedantic arguments about semantics.
- Noseshine 10y agoIt isn't pedantic. You asked about arithmetic of nominal numbers, which makes no sense at all. > "I don't care what the precise results of arithmetic are." This is wrong! That is NOT what "nominal numbers" are! I already quoted it, "nominal numbers" have no value! You are absolutely right though: This conversation has lead nowhere. I'm not sure your identification of who is to blame is correct though. You asked about nominal numbers, and when asked for details your examples all are about actual numbers. When I point that out your reaction is to be offended. How mature. You can't talk about "nominal numbers" and then be miffed that people don't understand that you are not actually talking about nominal numbers at all! I only come to understand that now. Tip: Don't talk about water when you mean sand, and then act confused when someone brings you water instead of sand.
- akkartik 10y agoIf I choose to add my phone number and yours, who's going to stop me? Would the universe explode? Would my phone number not be nominal anymore? It's a sort of "if a tree falls in the forest" question. Regardless of whether you're right or wrong (I just read the wikipedia page and didn't see anything about arithmetic, but maybe you have a phd in math), the essence of pedantry is to continue to insist I used the wrong word even after you understand what I meant.