Re: [fricas-devel] Possible compiler bug: "Cannot coerce" error while trying to use ^ on Float and Integer arguments

2020-11-02 Thread Mark Clements
As a follow-up, anonymous recursive functions in Axiom are described at: https://rosettacode.org/wiki/Anonymous_recursion#Axiom For the example: lab1method2(x: D, a: D, n: N): Float == zero? n => a.1 n = 1 => a.2 n = 2 => a.3 c := vect

Re: [fricas-devel] Possible compiler bug: "Cannot coerce" error while trying to use ^ on Float and Integer arguments

2020-11-01 Thread Waldek Hebisch
On Fri, Oct 30, 2020 at 06:10:25PM +0100, Ralf Hemmecke wrote: > > A. Obviously the SPAD compiler is unable to deal with recursive > local functions. :-( Yes, this is current limitation. -- Waldek Hebisch -- You received this message because you are subs

Re: [fricas-devel] Possible compiler bug: "Cannot coerce" error while trying to use ^ on Float and Integer arguments

2020-10-31 Thread Neven Sajko
Yes, indeed, in the end I converted the DirectProduct to Vector (with an extra variable) before entering the loop. The code is here: https://github.com/nsajko/discrete-math-lab1 Thanks, everyone. Neven -- You received this message because you are subscribed to the Google Groups "FriCAS - compu

Re: [fricas-devel] Possible compiler bug: "Cannot coerce" error while trying to use ^ on Float and Integer arguments

2020-10-31 Thread Ralf Hemmecke
Yes, this "immutability" seems sometime difficult to accept, but since it is easy to convert back and forth to Vector and use setelt! from there, it's not a big deal. Perhaps it it sometimes costs more copying than you wish to have. Ralf On 10/31/20 3:00 PM, Bill Page wrote: > The elements of Dir

Re: [fricas-devel] Possible compiler bug: "Cannot coerce" error while trying to use ^ on Float and Integer arguments

2020-10-31 Thread Bill Page
The elements of DirectProduct are intended to be immutable mathematical values, i.e a "tuple" in a n-tuple product, not a data container. On Sat, Oct 31, 2020 at 9:29 AM Neven Sajko wrote: > > Thank you for your insight, Bill. > > Does somebody know why does DirectProduct not have setelt! and qse

Re: [fricas-devel] Possible compiler bug: "Cannot coerce" error while trying to use ^ on Float and Integer arguments

2020-10-31 Thread Neven Sajko
Thank you for your insight, Bill. Does somebody know why does DirectProduct not have setelt! and qsetelt! ? Thanks, Neven -- 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 ema

Re: [fricas-devel] Possible compiler bug: "Cannot coerce" error while trying to use ^ on Float and Integer arguments

2020-10-30 Thread Bill Page
Two problems: First, unlike the interpreter, SPAD does not have multiple assignment. The error message about "compColon" is the compiler's poor way of trying to say that. Secondly, the DirectProduct domain does not have a direction coercion from (...) tuple, List or other similar domain. You need t

Re: [fricas-devel] Possible compiler bug: "Cannot coerce" error while trying to use ^ on Float and Integer arguments

2020-10-30 Thread Ralf Hemmecke
That's a nasty error that I cannot resolve without seeing the code. Usually when I get this, it is an identation problem in the code. Ralf On 10/30/20 6:28 PM, Neven Sajko wrote: > Hmm, I tried to implement lab1method2 with iteration with a for loop > instead of with recursion, but now Fricas tel

Re: [fricas-devel] Possible compiler bug: "Cannot coerce" error while trying to use ^ on Float and Integer arguments

2020-10-30 Thread Neven Sajko
Hmm, I tried to implement lab1method2 with iteration with a for loop instead of with recursion, but now Fricas tells me this: Internal Error Unexpected error in call to system function compColon The package is again attached. Thank you, Neven -- You received this message because you are subscr

Re: [fricas-devel] Possible compiler bug: "Cannot coerce" error while trying to use ^ on Float and Integer arguments

2020-10-30 Thread Ralf Hemmecke
On 10/30/20 4:41 PM, Neven Sajko wrote: > Thank you very much for your thoughtful responses, Ralf, I understand > Spad a bit better now thanks to you. However it seems that another > roadblock has appeared: while your lab1method1 works fine, lab1method2 > does not. At the end of the compilation the

Re: [fricas-devel] Possible compiler bug: "Cannot coerce" error while trying to use ^ on Float and Integer arguments

2020-10-30 Thread Neven Sajko
Thank you very much for your thoughtful responses, Ralf, I understand Spad a bit better now thanks to you. However it seems that another roadblock has appeared: while your lab1method1 works fine, lab1method2 does not. At the end of the compilation there are warnings about the function BOOT::|DMLAB1

Re: [fricas-devel] Possible compiler bug: "Cannot coerce" error while trying to use ^ on Float and Integer arguments

2020-10-30 Thread Ralf Hemmecke
Hi Neven, thank you. You hit another problem that is not clearly enough described in the book. When I started with AXIOM, it took some time until I understood, that not everything that works in the interpreter also works for the compiler. You have hit such a case here. Another thing that should go

[fricas-devel] Possible compiler bug: "Cannot coerce" error while trying to use ^ on Float and Integer arguments

2020-10-30 Thread Neven Sajko
Hello, I am getting the following error with the attached Spad code, in the implementation of lab1method1 while trying to create a matrix of Float values: Apparent user error: Cannot coerce i of mode (NonNegativeInteger) to mode (Fraction (Integer)) I don't know how to proceed. It seems as if th