How in xlisp can I get current clock time so I can print it?
Or otherwise figure out where time is going in my code?
How in xlisp can I get current clock time so I can print it?
Or otherwise figure out where time is going in my code?
Are you working up to give Audacity Time Of Day? That would be welcome.
Koz
I don’t think that you can, though it might be a nice feature for version 4 plug-ins.
How “fine grained” do you want to get?
You can approximate the time taken by a function by looping through it a large number of times.
Is there a more complete XLISP reference than http://www.cs.cmu.edu/~rbd/doc/nyquist/part19.html ?
I am referring to Common Lisp: The Language by Guy Steele. It dates from the 1980s, but apparently so does that web page. The book doesn’t have the object oriented stuff but it describes many things, some of which I find usable in the Nyquist prompt, others not.
For instance, today I discovered the incf and decf macros, which I don’t need to redefine for myself. But it was the book that told me that, not the web page.
This is the main XLISP manual that I use: http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/xlisp/xlisp-index.htm
The language reference (http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/xlisp/xlisp-ref/xlisp-ref-index.htm) is particularly useful as it provides examples for most of the functions.
I don’t think that INCF and DECF are standard XLISP functions, though they are available in Nyquist and appear in the Nyquist index: http://www.cs.cmu.edu/~rbd/doc/nyquist/indx.html
It is a common LISP standard function. It unfortunately misses the optional increase amount. I’ve seen Paul’s inc definition in the first plug-in and was wondering why he uses practically the same macro code…
The macros are also listed in my “Nyquist Reference” plug-in.
By the way, I’ve contacted Edgar about a possible clock implementation in Nyquist. That was about 3 weeks ago.
If the system function would work, the matter would be easy by echoing the system time into a file or by setting up a system variable that can be read out by get-env.
I hope Edgar will find a solution (he’s always very busy…).
I have an edition of Steele dated 1984. Is that still a good reference?
Is there a function that simply dumps all defined function and macro names? I could see what parts are implemented and which not.
I have noticed that not all is as in the book. For instance: make-array cannot take a list of dimensions but only a single number.
And also: (return-from tag value) is supposed to require that tag is in lexical scope, according to the book, but contrary to the book (and sometimes usefully for debugging), in Nyquist the tag is dynamically scoped, so I can write a long distance exit from any named function higher up the call stack at the time.
There’s quite a lot more stuff in Common Lisp that in XLISP. You’ll probably get quite frustrated if you use a book about Common Lisp as a language reference, but it will probably still be an excellent reference for other things, such as how to write in a “Lisp-like” way.
When I started using Nyquist, there was very little documentation. There was a Nyquist manual (similar to the current manual but less complete and less accurate), a brief introduction to XLISP by Edgar-rft, and (I think version 1 of) the XLISP manual by David Michael Betz, and the original version of this: http://audacityteam.org/help/nyquist There were also a few Nyquist plug-ins shipped with Audacity that could be used as examples, but they were not written by experienced LISP programmers so were not particularly good examples of “the right way” to write.
Since then, those documents have all been updated and expanded, and Edgar-rft wrote this “Nyquist Plug-ins Reference”: http://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference
My list of on-line documentation:
http://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference
http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/xlisp/xlisp-index.htm
http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/manual/home.html
http://www.cs.cmu.edu/~rbd/doc/nyquist/indx.html
http://dept-info.labri.fr/~idurand/enseignement/lst-info/PFS/Common/Strandh-Tutorial/indentation.html
There is also Robert’s “Little Helper” reference: https://forum.audacityteam.org/t/nyquist-reference-in-a-nut-shell/26911/1
There’s also Edgar Franke’s “Apropos” plug-in that lists all available functions and variables. It includes a search field. I’ve expanded it to show the actual variable values when “Variables only” is chosen:
apropos.ny (5.47 KB)
Although, this is an old topic, I am wondering if there is an answer to the original question. How to get time for debugging purposes?
As a dirty workaround I can export a fake file and see the time
when it was created.