home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,927 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 117,608 of 117,927   
   dxf to albert@spenarnc.xs4all.nl   
   Re: Generating a random sequence of Fort   
   03 Oct 25 18:22:37   
   
   From: dxforth@gmail.com   
      
   On 2/10/2025 9:07 pm, albert@spenarnc.xs4all.nl wrote:   
   > In article <68de4aaa@news.ausics.net>, dxf   wrote:   
   >> 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 ;   
   >   
   > CODE 3DUP   
   >     PUSH  RSP[3*CELL_SIZE]   
   >     PUSH  RSP[3*CELL_SIZE]   
   >     PUSH  RSP[3*CELL_SIZE]   
   >     NEXT,   
   > ...   
      
   That's equivalent to:   
      
   : 3DUP  2 PICK  2 PICK  2 PICK ;   
      
   I didn't notice but it's how VFX defines it.  OTOH  DUP 2OVER ROT   
   optimizes to the same machine code.  IIRC I tested them all on   
   DX-Forth and settled on the latter.  An 8086 code version would   
   beat it.  An 8080 code version would be more trouble than worth.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca