about tracing local functions in spad

10 views
Skip to first unread message

Qian Yun

unread,
Sep 18, 2024, 12:02:54 AMSep 18
to fricas-devel
(1) -> )trace INT )local
The )local option has been withdrawn
Use )ltr to trace local functions.

But we also have the following in i-syscmd.boot.
ltrace l == trace l

So it seems that the ability to trace local functions in spad
is not available right now?

Maybe we can start by cleaning up those outdated stuff.

- Qian

Waldek Hebisch

unread,
Nov 29, 2024, 8:27:23 AMNov 29
to fricas...@googlegroups.com
On Wed, Sep 18, 2024 at 12:02:49PM +0800, Qian Yun wrote:
> (1) -> )trace INT )local
> The )local option has been withdrawn
> Use )ltr to trace local functions.
>
> But we also have the following in i-syscmd.boot.
> ltrace l == trace l
>
> So it seems that the ability to trace local functions in spad
> is not available right now?

Yes, it is not available.

> Maybe we can start by cleaning up those outdated stuff.

Cleaning, yes. But tracing local functions is desirable and
AFAICS dispatch machinery works OK. Simply, we do not have
an implementation. We should probably fix misleading message,
to something like:

The )local option currently is unimplemented


--
Waldek Hebisch

Grégory Vanuxem

unread,
Nov 29, 2024, 6:30:49 PMNov 29
to fricas...@googlegroups.com
Hi,

That's possible. As usual apparently, first use your
functions/packages first and issue:

)ltr PACKAGE;mylocalfunc

From what I understood you need to specify each local function to trace.

Just tested on a personal package. Modified code is (put locally
jlPeakFlops() and comment the export, it is exported otherwise):

Implementation ==> add
jlPeakFlops : () -> JF64
jlPeakFlops() == jlEvalString("peakflops()")

normalize(v : JF64VEC) ==
vt := copy(v)
jlPeakFlops()
jlFunctionF64Vec("normalize!", vt)
vt

The session with modified package:

(1) -> )lib JRLA
JuliaRealLinearAlgebra is now explicitly exposed in frame frame1
JuliaRealLinearAlgebra will be automatically loaded when needed from
/home/greg/Git/jlfricas/JRLA.NRLIB/JRLA
(1) -> v:=nrand(4)$JF64VEC

(1)

-0.9845958110357397
-1.7483549860195138
-0.27299052001630286
-0.583854441867172

(2) -> normalize(v)

(2)

-0.4671851701911034
-0.8295845996325711
-0.1295324651241532
-0.2770356462349861

(3) -> )ltr JRLA;jlPeakFlops

Function traced: JRLA;jlPeakFlops
(3) -> jlPeakFlops()
There are no library operations named jlPeakFlops
Use HyperDoc Browse or issue
)what op jlPeakFlops
to learn if there is any operation containing " jlPeakFlops " in its name.

Cannot find a no-argument definition or library operation named jlPeakFlops .

(3) -> )tr JRLA

Function traced: JRLA;jlPeakFlops
Packages traced:
JuliaRealLinearAlgebra
Parameterized constructors traced:
JRLA
(3) -> normalize(v)
1<enter JuliaRealLinearAlgebra.normalize,17 : #(-0.9845958110357397
-1.7483549860195138
-0.27299052001630286
-0.583854441867172)
1<enter JRLA;jlPeakFlops : ...

- Greg
> --
> 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...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/Z0nBOOD8PTUsPsOA%40fricas.org.

Waldek Hebisch

unread,
Nov 30, 2024, 12:15:06 PMNov 30
to fricas...@googlegroups.com
On Sat, Nov 30, 2024 at 12:30:08AM +0100, Grégory Vanuxem wrote:
> Hi,
>
> That's possible. As usual apparently, first use your
> functions/packages first and issue:
>
> )ltr PACKAGE;mylocalfunc

Indeed, this works while using

)trace PACKAGE;mylocalfunc

fails. So, message is correct. OTOH that is really trace at
Lisp/Boot level. Spad tracing is supposed to be triggered by ')math'
andt work at higher level. So this is still to do.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages