Indeed, a working example would always be helpful, but in this case
it seems that the compiler auto-coerces "entries(p)" into something of type % and then the ".i" must be interpreted as elt from %.

Admittedly, it is sometimes nice that the compiler treats equally. But I wouldn't mind to insert per's and rep's explicitly just to be clear whether the object at hand is to be seen as something of type % or of type Rep. Note that both types usually can come with quite different exports.

I must say that after all these years I have not seen a documented rule of how and when an element is auto-coerced (or rather "pretend"ed to Rep or %. Similarly, I am missing the rul for X and Union(X,"failed").

Anyway, to me it looks like a compiler error.

Ralf


On 10/19/24 16:12, Qian Yun wrote:
Hi, showing a spad file that contains a minimal reproducible
example would be very helpful for people to debug.

If you want to debug it your self, you can utilize tools like
")trace",  or ")set break break" and Ctrl-C and "backtrace"
to examine the call stack, or use the good old "printf" to debug.

 From the posted snippet, I don't see a problem yet.

- Qian

On 10/19/24 9:54 PM, 'Prof. Dr. Johannes Grabmeier' via FriCAS - computer algebra system wrote:
I am revising Partition represented by List Integer:

     Rep := List Integer
     rep x ==> (x @ %) pretend Rep
     per x ==> (x @ Rep) pretend %

then I have a function

entries(p: %): List Integer == copy rep p

which is used for elt from Eltable(Integer, Integer):

     elt(p: %, i: Integer): Integer  ==
       i <= 0 => error "elt requires a positive second argument."
       i > #p => error "elt: second argument too large."
       entries(p).i

However, this constructs an infinite loop of calls to elt. Seamingly the elt from List Integer ( as I thinks this could should point to) is not called, but it uses the just defined elt from Partition.

The code is fixed by explicit function call:

elt(entries(p),i)$List(Integer)

Question: What is wrong here? Or if not  wrong, what is my misunderstanding?



--
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/362dd9b8-a526-4a3d-8f18-b466f224d5f9%40hemmecke.org.
  • [frica... 'Prof. Dr. Johannes Grabmeier' via FriCAS - computer algebra system
    • R... Qian Yun
      • ... 'Prof. Dr. Johannes Grabmeier' via FriCAS - computer algebra system
        • ... Grégory Vanuxem
          • ... 'Prof. Dr. Johannes Grabmeier' via FriCAS - computer algebra system
          • ... 'Prof. Dr. Johannes Grabmeier' via FriCAS - computer algebra system
            • ... Grégory Vanuxem
              • ... Grégory Vanuxem
      • ... 'Ralf Hemmecke' via FriCAS - computer algebra system
        • ... Grégory Vanuxem

Reply via email to