add real?, rational?, exact? and inexact? to cpprim #951
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The secondary easy part is to fix wrong error message in
vector->pseudo-random-generator. There was an(and (exacts? i) (integer? i))that generated an error inexact?instead of using the handler forvector->pseudo-random-generator.Anyway, I added a special case for
(and (#3%exacts? i) (integer? i))innpnanopassto detect the unsafe version of this combination.I could split all of this in an isolated commit if neccesary.
The main part is to add a few numerical predicated to
cpprim, in particularreal?,rational?,exact?andinexact?. For a future PR I care aboutreal?, because currentlyreal?is too slow.I'm not sure about the implementation details. In particular I'm using only one new library definition to handle the errors in
exact?andinexact?, but I saw many primitives with a dedicated error function. Is this fine?And I think the version should be updated, but I get ar CI error if I do., so I added a comment. I can change it or remove it or whatever is nessesary.
Another detail sis that in the predicates I'm using
but I can expand the
%typemacros to checkonly once and then look only at the
masks of each type. It would increase the speed a tiny bit but I think it's harder to read.