3 ms·
> Why not a type for even numbers? Odd, prime, not-prime, etc? Those are not mathematical entities in the same way as are the sets W (whole numbers) or N (nat
by tuatoru 5y ago
> Why not a type for even numbers? Odd, prime, not-prime, etc?
Those are not mathematical entities in the same way as are the sets W (whole numbers) or N (natural numbers, indices). It is reasonable to specify your domain closely, otherwise you end up with sqlite.
"Why not a type for datetimes or complex numbers?" would be a better question, as those are different kinds of things but not quite so frequently used in programming.
- still_grokking 5y agoI would question that primes are not mathematical entities. Same for other sets like "not-primes", or the odd numbers. Sets can be nicely approximated with types. (Some people say even that types correspond directly to sets).
- karmakaze 5y agoOT: It's funny how primes are given this property of 'primeness' and not-primes are those that don't have the property, when it's actually the opposite. The not-primes have the property of being composite (a product) and the primes are the negative space of numbers excluding composite numbers.
- still_grokking 5y agoI was more pointing in the direction of "sets" in general. Sets as such are mathematical entities. (Isn't there even a category of sets where sets are objects)? But apparently not everybody agree as this got down votes; or someone don't see the parallels between sets and types? Strange.
- taeric 5y agoThis is a bit of a false distinction, to me. Especially as a string, the motivating example for this thread, is also not the same.
- wmanley 5y ago> It is reasonable to specify your domain closely, otherwise you end up with sqlite It seems like you're trying to use SQLite as an example of something you don't want to end up with. This seems backwards so it weakens your argument. SQLite is one of the most widely deployed, reliable, broadly applicable and all round useful pieces of software ever written.