++ A class of objects which can be 'stepped through'.
++ Repeated applications of \spadfun{nextItem} is guaranteed never to
++ return duplicate items and only return "failed" after exhausting
++ all elements of the domain.
++ This assumes that the sequence starts with \spad{init()}.
++ For infinite domains, repeated application
++ of \spadfun{nextItem} is not required to reach all possible domain elements
++ starting from any initial element.


From the documentation of StepThrough, it is required that "init()"
stays the same.

Does your domain really need to implement StepThrough?

BTW, for those "Domain variables", there is no need to use Reference:
see commit 9dfdbc4cedc2d4a76230f707b238efe201d0a410 for example.

- Qian

On 1/22/24 23:15, Prof. Dr. Johannes Grabmeier wrote:
aha, this seems reasonable (but, who should know that?)

But, nevertheless problem is not solved: I now added a new exported function

init : () -> %

BUT: same behaviour,

the code

  init(): % ==
   if mLP 0 then print hconcat [toOF "init() called using oneToN1 = ", oneToN1 :: OF]

    per oneToN (deref n1Ref)

still seems to refer to the one inherited from StepThrough, namely

init: constant -> %

Question: how can these 2 function be distinguished?

And even worse:

I cannot use the category StepThrough in my case, because the code in the category uses the

init()-function with "contant". Obviously, implementing

init: constant -> %

there, one has not thought about the neccessity to switch that off in cases where the

domain has feature to change internal variables.

That is not satisfactory, would need a possibility to force the system at runtime to evaluate the function again, although it is defined with "constant".

Am 22.01.24 um 16:00 schrieb oldk1331:
The "constant" can cause the compiler to cache the result and return it directly next time, IIRC.

- Qian

On Mon, Jan 22, 2024, 10:39 PM Prof. Dr. Johannes Grabmeier <[email protected]> wrote:

    thanks, the rare instance of code for init() in the system, e.g. in
    QuotienFieldCategory is as follows:

      if S has StepThrough then
         init() == init()$S / 1$S

    my code says

    init(): % ==

    changes to

    init: % ==

    and

    init: ==

    both compile, but both do not change the wrong behaviour

    Are there semantic differences between

    f: constant -> %

    versus

    f: () -> %


    Am 22.01.24 um 15:25 schrieb Ralf Hemmecke:
    > I am not quite sure what the "constant" in this line actually means
    > (Is that documented somewhere?), but intuitively it might be the
    > sources of your "problem".
    >
    >
https://github.com/fricas/fricas/blob/master/src/algebra/catdef.spad#L1498

    >
    >
    > Ralf
    >
    --     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
    Fax: +49-(0)-991-2979592

    --     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]
    <mailto:fricas-devel%[email protected]>.
    To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/3cb26dbf-3d60-47f4-9490-7b0a2b530e69%40grabmeier.net.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/CAGBJN916frH6W2u1JoS%3DBep-rA0woUpLTw3GQsx7LR9eUYiYaA%40mail.gmail.com <https://groups.google.com/d/msgid/fricas-devel/CAGBJN916frH6W2u1JoS%3DBep-rA0woUpLTw3GQsx7LR9eUYiYaA%40mail.gmail.com?utm_medium=email&utm_source=footer>.


--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/49e502c3-2ce1-4c93-aca0-0827ace81315%40gmail.com.

Reply via email to