-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type inference for math functions in ANSI standard #21
base: master
Are you sure you want to change the base?
Conversation
aab3325
to
c62bcbe
Compare
Thanks for the contribution. Writing comprehensive unit tests will be quite some work. If you can summarize the type deduction logic that you've implemented it will make it easier. I can sort of grasp it from the code. You've defined a set of rules for the math operators and whether they produce a value of the same type depending on whether the arguments are fixnums, integers, rationals, or floats, and then deducing the type using these rules. |
Broadly, I'm trying to form a table out of certain common set of properties applicable to all (or most) numeric operations. I'm unsure if the properties I have currently considered are the good ones - so if someone comes up with a better set of properties, they can try implementing with those properties. The main type deducer is the
One of the central issue concerning how the argument types interact with the operation properties is the several numeric contagions: http://clhs.lisp.se/Body/12_aab.htm. It is probably this that can be the source of bugs. |
I added a few tests for +, -, *, /, 1+, and 1-. The tests cover the basic rules for |
Adding type inference for math functions is going to be a long project. Here are the initial steps in case anyone wants to build upon them. I will probably push to this as and when need them in other projects.
I don't think this should be merged without adding a good number of tests because this can break other code relying on correct behavior of cl-form-types.
Reference: