7 ms·
That is actually how Common Lisp represents time: https://www.cs.cmu.edu/Groups/AI/html/hyperspec/HyperSpec/Body/sec_25-1-4-2.html https://www.cs.cmu.edu/Group
by sedachv 10y ago
That is actually how Common Lisp represents time:
https://www.cs.cmu.edu/Groups/AI/html/hyperspec/HyperSpec/Body/sec_25-1-4-2.html https://www.cs.cmu.edu/Groups/AI/html/hyperspec/HyperSpec/Bo...
When you look up "integer": https://www.cs.cmu.edu/Groups/AI/html/hyperspec/HyperSpec/Body/syscla_integer.html#integer https://www.cs.cmu.edu/Groups/AI/html/hyperspec/HyperSpec/Bo...
"An integer is a mathematical integer. There is no limit on the magnitude of an integer."
What happens when an integer overflows from a fixnum (single-word representation) is that it gets upgraded to a bignum behind the scenes.
IMO Common Lisp is the only programming languages that handles time correctly out of the box, and aside from Scheme (http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-9.html#%_sec_6.2.1 http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z...), is the only programming language with proper support for numbers.
- MHordecki 10y agoPython supports arbitrary-width integers too. Its datetime implementation, however, is implemented partially in C, and does not support arbitrary timestamps.
- callalex 10y agoAnd up until recently didn't even give you access to a guaranteed monotonically increasing clock!
- kbp 10y agoLisp's support for numbers goes beyond automatic bignum promotion, for example (/ 1 3) gives the rational 1/3 instead of an approximation, and (sqrt -1) gives #C(0.0 1.0), that is, 0 + 1i.
- lispm 10y agoIn systems one still needs to interface Common Lisp with the real world in correct ways. Reading & printing dates in various formats wasn't always correct in some applications.