Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #42534
| From | "WJ" <w_a_x_man@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Text Expansion Macros |
| Date | 2015-10-09 21:59 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <mv9dbr$b2e$1@dont-email.me> (permalink) |
| References | <6ea00a35-e9c1-4c17-96f5-888d1835b59f@googlegroups.com> |
humptydumpty wrote:
> : split-at-address ( ca u a -- a u-len ca len ;
> len = a-ca split WORD at ADDRESS to REST and QUOTIENT )
> SWAP >R \ ca a
> OVER - 2DUP \ ca len ca len
> R> SWAP \ ca len ca u len
> /STRING 2SWAP
> ;
Look at all of the stack comments the wretch had to use, because
his Masters taught him that local variables are wicked!
Anyone who would pay a penny for code like that is an idiot.
> : -heading ( ca u -- ca' u' )
> BEGIN DUP 0> WHILE OVER C@ BL = WHILE 1 /STRING REPEAT THEN
> ;
Instead of substandard Forth, let's use standard Forth.
Oforth:
>" word " strip .
word ok
> : split-at-space ( ca u -- ra ru qa qu ;
> split WORD at space to REST and QUOTIENT )
> 2DUP BL scan drop \ ca u a
> split-at-address
> ;
Let's test that.
s" foo bar " split-at-space ok
type ok
type foo bar ok
Now, in standard Forth (Oforth):
>" able was I ere " words .
[able, was, I, ere] ok
> : maximum
> [ S" <" S" choose" ]E
> ;
> : minimum
> [ S" >" S" choose" ]E
> ;
> : umaximum
> [ S" U<" S" choose" ]E
> ;
> : uminimum
> [ S" U>" S" choose" ]E
> ;
> 1 -1 maximum . .s -1 1 maximum . .s cr
> 1 -1 minimum . .s -1 1 minimum . .s cr
Instead of substandard Forth, let's use standard Forth.
Oforth:
: maximum { maxFor( #yourself ) }
>[3, 0, 5, 888, 7, 9] maximum .
888 ok
--
The report card by the American Society of Civil Engineers showed the national
infrastructure a single grade above failure, a step from declining to the point
where everyday things simply stop working the way people expect them to. ---
washingtonpost.com/local/trafficandcommuting/us-infrastructure-gets-d-in-annual-report/2013/03/19/c48cb010-900b-11e2-9cfd-36d6c9b5d7ad_story.html
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Text Expansion Macros humptydumpty <ouatubi@gmail.com> - 2015-10-09 13:21 -0700
Re: Text Expansion Macros "WJ" <w_a_x_man@yahoo.com> - 2015-10-09 21:59 +0000
Re: Text Expansion Macros "HAA" <someone@microsoft.com> - 2015-10-16 16:11 +1000
Re: Text Expansion Macros Mark Wills <markwills1970@gmail.com> - 2015-10-16 04:26 -0700
Re: Text Expansion Macros Coos Haak <chforth@hccnet.nl> - 2015-10-10 00:19 +0200
Re: Text Expansion Macros humptydumpty <ouatubi@gmail.com> - 2015-10-09 21:11 -0700
Re: Text Expansion Macros humptydumpty <ouatubi@gmail.com> - 2015-10-16 10:18 -0700
Re: Text Expansion Macros humptydumpty <ouatubi@gmail.com> - 2015-10-19 03:23 -0700
csiph-web