3 ms·
> What? There are several different numeric types. It's there to implement more advanced mathematics capabilities. There is no such thing as multiple types in
by catnaroek 13y ago
> What? There are several different numeric types. It's there to implement more advanced mathematics capabilities.
There is no such thing as multiple types in Common Lisp.
> Haskell's numeric capabilities were in part copied from Common Lisp.
Haskell's standard type classes include the notions of ring (Num), field (Fractional* ) and integer (Integral). (Notably absent is the notion of semiring, which would be useful for a type of natural numbers, though.) The importance of making these distinctions is that you can statically ensure that you are using certain algebraic structures but not others.
* Somehow floating points were invited to the party, but, hey! I guess no standard library can be perfect.
- lispm 13y agoFor most practical applications this is not necessary at all. Common Lisp has countless mathematical applications which make use of its various numeric data types.
- catnaroek 13y agoWe are using different notions of type. For me, a type is a static guarantee about the meaning of a syntactic term in the program, rather than a mere labelling of values during the runtine process. In the sense of type that I use, Common Lisp does not have but just one type, and it is not even a type of numbers - it is a type of everything. All in all, I did not intend to overly diss Common Lisp. It is a very flexible, expressive and powerful language. I am just saying that, at least from my point of view, Common Lisp does not look particularly inspired by mathematics.