Date: Thu, 2 Oct 2025 19:49:29 +1000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Generating a random sequence of Forth words Newsgroups: comp.lang.forth References: <2025Sep30.183350@mips.complang.tuwien.ac.at> Content-Language: en-GB From: dxf In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: news.ausics.net Message-ID: <68de4aaa@news.ausics.net> Organization: Ausics - https://newsgroups.ausics.net Lines: 20 X-Complaints: abuse@ausics.net Path: csiph.com!news.bbs.nz!news.ausics.net!not-for-mail Xref: csiph.com comp.lang.forth:134231 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.