Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #9129

Re (2): existing code to build a 'sed-like'?

From no.top.post@gmail.com
Newsgroups comp.lang.forth
Subject Re (2): existing code to build a 'sed-like'?
Date 2012-01-22 06:36 +0000
Organization A noiseless patient Spider
Message-ID <jfgap1$2u2$1@dont-email.me> (permalink)
References <4f1ad6d4$0$293$14726298@news.sunsite.dk>

Show all headers | View raw


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

> On 1/21/12 9:34 AM, no.top.post@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.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

existing code to build a 'sed-like'? no.top.post@gmail.com - 2012-01-21 14:34 +0000
  Re: existing code to build a 'sed-like'? Doug Hoffman <glidedog@gmail.com> - 2012-01-21 10:16 -0500
    Re (2): existing code to build a 'sed-like'? no.top.post@gmail.com - 2012-01-22 06:36 +0000
  Re: existing code to build a 'sed-like'? "Elizabeth D. Rather" <erather@forth.com> - 2012-01-21 08:25 -1000
  Re: existing code to build a 'sed-like'? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-01-21 15:54 -0500
    Re (2): existing code to build a 'sed-like'? no.top.post@gmail.com - 2012-01-22 10:03 +0000

csiph-web