StepThrough for NNI and PI

9 views
Skip to first unread message

Prof. Dr. Johannes Grabmeier privat

unread,
May 6, 2019, 1:44:40 PM5/6/19
to fricas...@googlegroups.com
While Integer inherits from IntegerNumberSystem the category
StepThrough, the domains NNI and PI do not share this natural property.
I have added this, however, while init() overwrites the inherited
functiom init() (as a subdomain of Integer), this is not the case for
the correct nextItem, i.e. the interpreter chooses the function from
Integer and not from the domain PI itsself:

(1) -> init()$Integer

   (1)  0
                                                                                      
Type: Integer
(2) -> nextItem %

   (2)  1
                                                                           
Type: Union(Integer,...)
(3) -> nextItem %

   (3)  - 1
                                                                           
Type: Union(Integer,...)
(4) -> nextItem %

   (4)  2
                                                                           
Type: Union(Integer,...)


after compilation of integer-jg.spad, which I include:


(6) -> init()$NNI

   (6)  0
                                                                           
Type: NonNegativeInteger
(7) -> nextItem %

   (7)  1
                                                                           
Type: Union(Integer,...)
(8) -> nextItem %

   (8)  - 1
                                                                           
Type: Union(Integer,...)
(9) -> init()$PI

   (9)  1
                                                                              
Type: PositiveInteger
(10) -> nextItem %

   (10)  - 1
                                                                           
Type: Union(Integer,...

--
Mit freundlichen Grüßen

Johannes Grabmeier

Prof. Dr. Johannes Grabmeier
Köckstraße 1, D-94469 Deggendorf
Tel. +49-(0)-991-2979584, Tel. +49-(0)-151-681-70756
Tel. +49-(0)-991-3615-141 (d), Fax: +49-(0)-32224-192688

integer-jg.spad

Ralf Hemmecke

unread,
May 6, 2019, 4:41:36 PM5/6/19
to fricas...@googlegroups.com
> after compilation of integer-jg.spad, which I include:
>
>
> (6) -> init()$NNI
>
>    (6)  0
>                                                                            
> Type: NonNegativeInteger
> (7) -> nextItem %
>
>    (7)  1
>                                                                            
> Type: Union(Integer,...)

That "Integer" appears here looks somehow strange to me.

I guess, calling like below is no option since StepThrough is usually
invoked by the Interpreter.

(69) -> n: NNI := init()$NNI

(69) 0
Type: NonNegativeInteger
(70) -> n := nextItem n
nni

(70) 1
Type: NonNegativeInteger
(71) -> n := nextItem n
nni

(71) 2
Type: NonNegativeInteger

Looks like some autocoercion to Integer is applied in your case.

Ralf
Reply all
Reply to author
Forward
0 new messages