Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.forth > #134231

Re: Generating a random sequence of Forth words

Date 2025-10-02 19:49 +1000
Subject Re: Generating a random sequence of Forth words
Newsgroups comp.lang.forth
References <2025Sep30.183350@mips.complang.tuwien.ac.at> <nnd$60c544bd$6fdf6f8e@13070880e71750ef> <mk5b0uFubm8U1@mid.individual.net>
From dxf <dxforth@gmail.com>
Message-ID <68de4aaa@news.ausics.net> (permalink)
Organization Ausics - https://newsgroups.ausics.net

Show all headers | View raw


On 2/10/2025 4:42 am, minforth wrote:
> Am 01.10.2025 um 17:11 schrieb Hans Bezemer:
>> I used something similar - but with a whole slew of stack operations. Very handy thingy. I use it until this day.
>>
>> ( abc -- abcabc)   >r over over r@ rot rot r> \ >r 2dup r@ -rot r>
>>
> 
> Different and probably not as efficient as your code generator:
> 
> MinForth 3.6
> # : 3DUP { a b c == a b c a b c } ;

For 3DUP I believe this is the one to beat:

: 3DUP ( a b c -- a b c a b c )  dup 2over rot ;

With NTF/LFX the locals version will break even.  For others, well, it may
be better not to look.  For a straight-forward example of 'stack juggling',
locals handle it rather poorly.

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


Thread

Generating a random sequence of Forth words anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2025-09-30 16:33 +0000
  Re: Generating a random sequence of Forth words minforth <minforth@gmx.net> - 2025-10-01 11:20 +0200
    Re: Generating a random sequence of Forth words anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2025-10-01 17:10 +0000
  Re: Generating a random sequence of Forth words Hans Bezemer <the.beez.speaks@gmail.com> - 2025-10-01 17:11 +0200
    Re: Generating a random sequence of Forth words minforth <minforth@gmx.net> - 2025-10-01 20:42 +0200
      Re: Generating a random sequence of Forth words dxf <dxforth@gmail.com> - 2025-10-02 19:49 +1000
        Re: Generating a random sequence of Forth words albert@spenarnc.xs4all.nl - 2025-10-02 13:07 +0200
          Re: Generating a random sequence of Forth words dxf <dxforth@gmail.com> - 2025-10-03 18:22 +1000
        3dup again (was: Generating a random sequence of Forth words) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2025-10-02 20:44 +0000
          Re: 3dup again (was: Generating a random sequence of Forth words) albert@spenarnc.xs4all.nl - 2025-10-03 11:02 +0200
            Re: 3dup again minforth <minforth@gmx.net> - 2025-10-03 11:09 +0200
              Re: 3dup again anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2025-10-04 08:04 +0000
          Re: 3dup again Hans Bezemer <the.beez.speaks@gmail.com> - 2025-10-05 11:29 +0200
  Re: Generating a random sequence of Forth words antispam@fricas.org (Waldek Hebisch) - 2025-10-15 19:19 +0000
    Re: Generating a random sequence of Forth words anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2025-10-24 15:55 +0000

csiph-web