Re: I beleive that forth could supplant ruby and perl and python if it wanted to



Bernd Paysan <bernd.paysan@xxxxxx> wrote:
Andrew Haley wrote:

over + swap ?do dup c@ i c! 1+ loop drop

A bit simpler, use all idioms you have:

: move ( src dest len -- )
bounds ?do count i c! loop drop ;

Looks perfect, just 7 words.

I'm a great believer in what Brodie called "cliches". OVER + SWAP is
one such: I just know what it does, I don't see it as three words with
a stack action. As for the abuse of COUNT... :-)

Andrew.
.



Relevant Pages

  • Re: pfannkuch
    ... Bernd Paysan wrote: ... Probably too much setup overhead in the flipping (the loop is short!). ... tos = 1 -> loop terminated ...
    (comp.lang.forth)
  • Re: removing spaces when mixing variables / text
    ... >to generate random dotted quad IP addresses, just to see if I could do it. ... Mike pointed out one a common idioms that includes a couple of idioms. ... combine an expression and a loop, ... The loop is used to iterate 4 times. ...
    (comp.lang.python)
  • Re: Newbie question about file input
    ... Create a loop with a foo ... Python often tries to have only one obvious way to do something. ... Other languages have two or three or even more different ways ... downside, if you want to think of it as such, is that idioms ...
    (comp.lang.python)
  • Re: Buffer access with bounds checking...
    ... Bernd Paysan writes Re: Buffer access with bounds checking... ... foo #80 + b@ + ... LOOP ...
    (comp.lang.forth)
  • Re: Reading a key inside a loop
    ... I for one consider both these forms to be aberrations ... rather than idioms. ... The most common idiomatic ways to write a loop ... The more conventional form of infinite loop prefix is ...
    (comp.lang.c)