Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: [AWK GREP] AWK and GREP funcs, arg order

From: GedB::Rushcoding::co::uk at: 18-May-2007 10:12

On 5/18/07, Gregg Irwin <gregg-pointillistic.com> wrote:
> Both AWK and GREP take the program/pattern first. I did that for both > of mine originally, then changed RAWK to take the sources first, which > I think I prefer. They could both eventually load their program or > pattern specs from disk, and files can be a single name, a block of > files, a file spec (glob), or a variable. > > Are we applying the program to the files, or the files to the program? > > -- Gregg >
I think the logic is that the program/pattern is mostly likely to be reused against different files. For example, if you have a pattern for cleaning up whitespace then that pattern is unlikely to change. You will, however, apply that pattern to different files. So the part that is most likely to change is kept at the end. This especially makes sense in a command line environment, since it involves retrieves the commands last use, deleting the last paramater and typing a new one. If the file to be update came first, you would have to retrieve the last use, navigate to the filename, delete it while being careful to leave the pattern intact, and then insert the new filename. Ged.