Get time for debugging purposes

Using Nyquist scripts in Audacity.
Post and download new plug-ins.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Paul L
Posts: 1782
Joined: Mon Mar 11, 2013 7:37 pm
Operating System: Please select

Get time for debugging purposes

Post by Paul L » Mon Nov 04, 2013 8:12 pm

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?

kozikowski
Forum Staff
Posts: 68902
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Get time for debugging purposes

Post by kozikowski » Tue Nov 05, 2013 6:52 am

Are you working up to give Audacity Time Of Day? That would be welcome.
Koz

steve
Site Admin
Posts: 80679
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Get time for debugging purposes

Post by steve » Tue Nov 05, 2013 8:24 am

Paul L wrote:How in xlisp can I get current clock time so I can print it?
I don't think that you can, though it might be a nice feature for version 4 plug-ins.
Paul L wrote:Or otherwise figure out where time is going in my code?
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.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Paul L
Posts: 1782
Joined: Mon Mar 11, 2013 7:37 pm
Operating System: Please select

Re: Get time for debugging purposes

Post by Paul L » Tue Nov 05, 2013 9:17 pm

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.

steve
Site Admin
Posts: 80679
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Get time for debugging purposes

Post by steve » Tue Nov 05, 2013 9:30 pm

This is the main XLISP manual that I use: http://www.audacity-forum.de/download/e ... -index.htm
The language reference (http://www.audacity-forum.de/download/e ... -index.htm) is particularly useful as it provides examples for most of the functions.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 80679
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Get time for debugging purposes

Post by steve » Tue Nov 05, 2013 9:35 pm

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
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Robert J. H.
Posts: 3633
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 10

Re: Get time for debugging purposes

Post by Robert J. H. » Tue Nov 05, 2013 11:46 pm

steve wrote: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.

Robert J. H.
Posts: 3633
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 10

Re: Get time for debugging purposes

Post by Robert J. H. » Tue Nov 05, 2013 11:51 pm

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...).

Paul L
Posts: 1782
Joined: Mon Mar 11, 2013 7:37 pm
Operating System: Please select

Re: Get time for debugging purposes

Post by Paul L » Wed Nov 06, 2013 4:24 am

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.

steve
Site Admin
Posts: 80679
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Get time for debugging purposes

Post by steve » Wed Nov 06, 2013 4:36 pm

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/Nyqui ... _Reference

My list of on-line documentation:

http://wiki.audacityteam.org/wiki/Nyqui ... _Reference
http://www.audacity-forum.de/download/e ... -index.htm
http://www.audacity-forum.de/download/e ... /home.html
http://www.cs.cmu.edu/~rbd/doc/nyquist/indx.html
http://dept-info.labri.fr/~idurand/ense ... ation.html

There is also Robert's "Little Helper" reference: http://forum.audacityteam.org/viewtopic ... 03#p195503
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply