On 04/09/2017 07:17 PM, Waldek Hebisch wrote:
> So 'PositiveInteger' seem to come from the code above. Clearly we
> need smarter version of 'axFormatType'. As quick fix something like
>
> ....
> INTEGERP typeform =>
> typeform = 0 =>
> ['RestrictTo, ['LitInteger, '"0"], 'Integer]
> ...
>
> may do.
Yes, that compiles well and is a solution for now. The problem will
probably bite us again, if someone starts to use a negative base in
IndexedVector.
The patch I actually tested is given below.
I've just added a line that leads to
(|Import|
(|With| NIL (|Declare| |integer| (|Apply| -> |Literal| %)))
|Integer|)
in the generated .ap file.
Waldek, since this patch actually comes from your idea to fix the
problem, I think credit should solely go to you.
Ralf
diff --git a/src/interp/ax.boot b/src/interp/ax.boot
index 531716b..e4825f2 100644
--- a/src/interp/ax.boot
+++ b/src/interp/ax.boot
@@ -221,7 +221,10 @@ axFormatType(typeform) ==
STRINGP typeform =>
['Apply,'Enumeration, INTERN typeform]
INTEGERP typeform =>
- -- need to test for PositiveInteger vs Integer
+ -- need to test for PositiveInteger vs Integer
+ typeform = 0 =>
+ axAddLiteral('integer, 'Integer, 'Literal)
+ ['RestrictTo, ['LitInteger, '"0"], 'Integer]
axAddLiteral('integer, 'PositiveInteger, 'Literal)
['RestrictTo, ['LitInteger, STRINGIMAGE typeform ],
'PositiveInteger]
FLOATP typeform => ['LitFloat, STRINGIMAGE typeform]
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.