Loading ...
Sorry, an error occurred while loading the content.

RE: [Clip] Re: Have we got a numeric sort yet?

Expand Messages
  • Pete Turner
    G day, ... 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
    Message 1 of 32 , Oct 31, 2010
    • 0 Attachment
      G'day,

      --- In ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> ,
      "Paul" <xboa721@...> wrote:

      > A shared sentiment...
      >
      > --- In ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> ,
      > "diodeom" <diomir@...> wrote:
      >
      > > I'd say it ain't very poetic having to crudely paste variable strings
      > (either temporarily in a current or in a scrap doc) in order to utilize
      > regular expressions on them. I'd be elated if NT had a function similar
      > to ^$StrReplace()$ but capable of accepting regex patterns. And I'm
      > fairly sure this sentiment wouldn't be only mine.
      >
      > Agreed. Doing a regex find/replace on a variable was one of the first
      > things I tried to do with my first clip...
      >
      > > If NoteTab's own regex-attuned variable-testing command ^!IfMatch
      > could be seen as an equivalent to Perl's *if ($string =~ m/regex/)*,
      > why couldn't some of the lovely "out-of-sight" functionality of
      > *s/regex/replacement/modifiers* be replicated as well... some day?
      > Pretty please! :)
      >
      > NTP can call an external script but having never written a single line
      > of perl code and tried this functionality it seems there's merit to
      > containing the functionality within the already impressive clip
      > framework. Doesn't sound too difficult really cause variables can
      > already cope with multi-megabyte contents....
      >
      > Excuses aside, this would be a highly desirable language feature, would
      > it not?


      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? A bit messy, and I haven't tried it, but it might be worth a go, writing it a separate clip that can be called from any other clip.


      Pete
    • Paul
      ... 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
      Message 32 of 32 , Dec 1, 2010
      • 0 Attachment
        --- In ntb-clips@yahoogroups.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>

        Cheers,
        Paul
      Your message has been successfully submitted and would be delivered to recipients shortly.