|
 |
Working on sorting algorithms. I thought I had some of these coded in the
past.... But I guess I'll just rewrite them.
Out of:
Bubble Sort
Selection Sort
Insertion Sort
Quick Sort
Merge Sort
Shell Sort
Heap Sort
I got the first 4 coded, and was thinking about timing them.
(Also, the way Quick sort is recursive, it's not straightforward to code and
keep the original unsorted array unmodified - so I think I'll make that a
macro-within-a-macro.)
My idea was to have a "wrapper", where a timing macro would take a sorting macro
as an argument, log the start time, run the macro, log the end time, and then
spit the elapsed time out to the #debug stream.
Here's what I'm doing at 7am, which obviously does NOT work, but it illustrates
the idea with pseudocode / unworkingcode.
#macro Print () #debug "inner macro \n\n" #end
#macro Test (optional Directive)
Directive
#end
Test (Print())
Do we think there might be a way to bamboozle the parser into letting one macro
run another macro, being passed in as an argument? ParseString perhaps?
Post a reply to this message
|
 |