On Sun, Apr 27, 2025 at 01:55:13PM -0400, Camm Maguire wrote:
> Greetings!  I'm wondering if you can help me map this to a lisp function
> failure, or at least point me in the right direction.  I think the two
> are related.  The sort is fine with abs1 -> abs.  Or if abs1(x: Integer):
> Integer == abs(x).  I cannot trace this.  |abs1| is not fboundp.  I do
> not understand how axiom handles anonymous function calls, or why these
> are considered anonymous, as abs1 is a name.
> 
> >> > 1) The FriCAS snippet below gives no output using gcl-2.7.1:
> >> >
> >> > x+-> if x < 0 then - x else x
> >> > abs1 := %
> >> > (x,y) +-> abs1(x) > abs1(y)
> >> > sort(%,[3,9,-4,10,-3,-1,-9,5])

Tracing like below:

x+-> if x < 0 then - x else x
abs1 := %
(x,y) +-> abs1(x) > abs1(y)
)lisp (trace |evalTargetedADEF1|)
)lisp (trace |compileTargetedADEF|)
)lisp (trace |compileBody|)
)lisp (trace |compileADEFBody|)
)lisp (trace |compileInteractive|)
)lisp (trace |timedOptimization|)
)lisp (trace |compQuietly|)
)lisp (trace |COMP|)
)lisp (trace |COMP_2|)
)lisp (trace |COMP370|)
)lisp (trace compile-defun)
)lisp (trace compile)
sort(%,[3,9,-4,10,-3,-1,-9,5])

gives me as the last part:

                  9> (COMPILE-DEFUN
                      |*2;anonymousFunction;0;frame0;internal|
                      (DEFUN
                       |*2;anonymousFunction;0;frame0;internal|
                       (#1=#:G12 #2=#:G13 |envArg|)
                       (>
                        (SPADCALL #1# '(#<function 0000000001d08e20>))
                        (SPADCALL #2# '(#<function 0000000001d092d0>)))))
                    10> (COMPILE
                         |*2;anonymousFunction;0;frame0;internal|)

So it seems that trouble is in 'compile' called from 'compile-defun'.
'compile-defun' is:

(defun compile-defun (name body) (eval body) (compile name))

I also have:

)lisp (describe #'|*2;anonymousFunction;0;frame0;internal|)

#<function 0000000001d09300> - SYSTEM:INTERPRETED-FUNCTION

which confirms that 'eval' part worked, but 'compile' failed.
Calling |*2;anonymousFunction;0;frame0;internal| seem to work.

-- 
                              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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/fricas-devel/aA665wKsFc6NkY_d%40fricas.org.

Reply via email to