On Thu, Nov 14, 2024 at 01:17:54AM +0100, Waldek Hebisch wrote: > On Wed, Nov 13, 2024 at 12:11:50PM +0100, 'Ralf Hemmecke' via FriCAS - > computer algebra system wrote: > > The output of the following function is strange. > > Why is dbgPrint executed twice? > > > > %%% (9) -> fooo(2) > > Compiling function bar with type (Integer, Integer) -> List(Integer) > > > > Compiling function fooo with type Integer -> Integer > > [:> , ab, [1, 2]] > > [:> , ab, [1, 2]] > > > > (9) 2 > > Type: PositiveInteger > > > fooo(n: ZZ): ZZ == (_ > > n < 2 => error "argument must be > 2";_ > > [P1n, Q1n, R1n] := bar(1, n);_ > > Q1n) > > Concerning reasons, in interpreter such assignment uses pattern > matching. 'bar' is evaluated once to get argument to pattern > matching function. But assignment also produces a value and > 'bar' is evaluated second time to get (ignored) return value > of the assignment.
I have now commited fix for this to the trunk. -- Waldek Hebisch -- 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 fricas-devel+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/aCf2TtY0raGm5ShH%40fricas.org.