[Oberon] Why transform text via a file?

Chris Glur easlab at absamail.co.za
Sun Jan 22 07:48:32 CET 2012


AFAICS the interesting Mail.Mod question raised was not answered and
just evaporated.  Although I doubt that it's related to the following:
files [pipes] are nice for transforming text, because they automatically
adjust their size, and eg. facilitate the economical [in human effort]
concatenative style.
<><><><><> 
Newsgroups: comp.lang.forth
Subject: Re (2): existing code to build a 'sed-like'?
References: <4f1ad6d4$0$293$14726298 at news.sunsite.dk>

In article <4f1ad6d4$0$293$14726298 at news.sunsite.dk>, Doug Hoffman <glidedog at gmail.com> wrote: 

> On 1/21/12 9:34 AM, no.top.post at gmail.com wrote:
> 
> > I get the impression that forth programmers don't code at a high level.
> 
> Without getting sidetracked on the meaning of "high level" I believe 
> that is a fair assessment.  There are of course exceptions such as 
> people like me that don't do embedded (resource constrained) work and 
> instead program for the desktop.
> 
> > Is that because no libraries of convenient tools/functions exist,
> > for such functions to just be concatenated?
> 
> I believe so, at least historically.  Recently there have been more 
> focused efforts toward centralizing/building/improving such libraries so 
> reinventing wheels in Forth is minimized.
> 
> -Doug
Recently: after 35 years?

Here's an example of hi-level which can profitably use the 
concatinative style which I'm harping on about:-
If I want to 'clean':
> > > You have it the wrong way around. Interpretation is a special
   case of
> > > execution. Very simply stated (because someone here is bound to
   take
> > > issue ...), a VM is a loop, an interpreter, and an emulated
   processor,
> > > implemented in machine code, via compiled C or assembled
   assembly,
> > > which is executed.
to get:
>>>You have it the wrong way around. Interpretation is a special
>>>case of execution. Very simply stated (because someone here
>>>is bound to take issue ...), a VM is a loop, an interpreter,
>>>and an emulated processor, implemented in machine code,
>>>via compiled C or assembled assembly, which is executed.
  previously I'd be thinking in terms of indices and pointers,
  which is expensive.  Now with knowledge of concatinative style 
  and many good examples of *nix script I do:
GetText |
RemoveAll ">" |
Replace <EndOfLine> with <space> |
UseExistingFormatterFor1spaceBetweenWords&WrapLineLength  66 |
DeleteLeading <spaces>

Which the *nix 1-line-jockeys write as the 5 transformations:
 cat d2  |  sed s/">"//g |  tr "\012" "\040"|  fmt -u -w 66 | sed s/^" "*// 
Which could be called eg. `cleanUSEnet` 
And  3 times: | sed s/^/">"/ 
 adds the leading ">>>".

I don't like the *nix syntax,   but forth-users are 'almost there'
in their method, and something like:
"d2 cleanUSEnet
3 cite"
would be a nice syntax.

== Chris Glur.




More information about the Oberon mailing list