[Clip] Re: Have we got a numeric sort yet?
- --- In firstname.lastname@example.org, Pete Turner <pete.turner@...> wrote:
> Until Eric answers our prayers, how about creating a new document on the fly, copying the variable to it, then doing a regex find/replace on the document, copying back to the variable, then deleting the document?That's a great idea Pete, it works and the implemented solution can be found in the files section as a clip you can call from any other clip.
I also provided a neat way of sorting a kind of hash array in the format number#some text.
Using ^!SetScreenUpdate 0 means the process of creating a temp document and subsequent processing is completely transparent.
- --- In email@example.com, "Eb" <ebbtidalflats@...> wrote:
>... NoteTab is an interpreter, not a compiler. That means any complex algorithm you build in clip code is going to be much slower, than it would be as a compiled (built-in) function.I'm still impressed how quick clips run. Reminds me of writing good old Advanced Basic code running on an XT. You know, a 5.1 gogigahertz machine still processes a spreadsheet about as fast as it used to!
> Bubble sort requires (n squared) iterations in the worst-case scenario.That sounds better. Thanks for the reminder.
> On the other hand, it might be a good exercise to code in clip code. <grin>Just for comparison</grin>.Gone are the days of the lazy uni student where time was a misspent luxury... <sigh> ... although I can't complain.. I had an entire half a Sunday to sit and relax this week. :)
My current project needed a 'calculate by hand' style multiplication routine to handle ridiculously large numbers. To be honest, I don't mind the 7 seconds it takes to multiply two - one hundred digit -numbers.
Fascinating really and the exciting bit is that we seem to have come full circle and once again the computer is doing exactly what the user wants... without the OOP, "compiler declares headache" syndrome. <smile> </b>