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,362 of 117,927    |
|    Hans Bezemer to Paul Rubin    |
|    Re: Parsing timestamps?    |
|    01 Jul 25 18:53:44    |
      From: the.beez.speaks@gmail.com              On 30-06-2025 11:44, Paul Rubin wrote:       > zbigniew2011@gmail.com (LIT) writes:       >> "Pick and Roll are the generic operators which treat the data stack as       >> an array. If you find you need to use them, you are probably doing it       >> wrong. Look for ways to refactor your code to be simpler instead."       >       > What is the origin of that quote? PICK treats the stack like an array,       > but ROLL treats it more as a circular shift register.       >       > Most CPUs these days have a register file, which is essentially an array       > with only immediate-like addressing mode. Presumably that design       > evolved because programmers found it useful.       >       > PICK afaict is mostly used with literal offsets as well. Having a       > variable offset is suspicious.       >       > : 3DUP ( a b c -- a b c a b c ) 3 PICK 3 PICK 3 PICK ;       >       > Seems clearer than some mess of ROT and return stack temporaries.              If I so desperately wanted it I'd make a primitive out of it:              CODE (3DUP) DSIZE (3); DFREE (3);        a = DS(3); DPUSH (a);        a = DS(3); DPUSH (a);        a = DS(3); DPUSH (a); NEXT;              However - I use it RARELY. So, it's not worth the trouble to hardcode it.              $ pp4th -x stackopt.4th abc abcabc       - Trying a 1 word solution..       No solutions.       - Trying a 2 word solution..       No solutions.       - Trying a 3 word solution..       No solutions.       - Trying a 4 word solution..       No solutions.       - Trying a 5 word solution..       No solutions.       - Trying a 6 word solution..       No solutions.       - Trying a 7 word solution..        >r over over r@ rot rot r>       $              That'll do.              Hans Bezemer              --- 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