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 116,462 of 117,927    |
|    Krishna Myneni to All    |
|    Re: convenient stack operation: a b c --    |
|    04 May 24 12:13:43    |
      From: krishna.myneni@ccreweb.org              On 5/4/24 10:14, NN wrote:       > On 30/11/2023 6:55 pm, Krishna Myneni wrote:       >> I'm in need of a convenient way to do the following for the fp stack,       >> but we can pose the problem for the data stack:       >>       >> a b c -- b a c       >>       >> Two ways to do this on the data stack are       >>       >> ROT SWAP       >>       >> >R SWAP R>       >>       >> ( the latter can't be done from the interpreter, portably at least ).       >>       >> Is there a word I'm not remembering to perform this operation? If not       >> what name would one give to this stack operation?       >>       >> SWAP-UNDER       >> ROTSWAP       >> RISE       >>       >> For fp stack manipulation, I had posted mostly portable code for F>R       >> and FR> to push and pop from the floating point stack to/from the       >> return stack. A significant reason for suggesting the F>R FR> pair is       >> to deal with this situation where having to use FROT FSWAP would be       >> inefficient on non-analytic compilers.       >>       >> Maybe a generic swap operation at depth u, called RISE, is useful e.g.       >>       >>       >> 0 RISE \ same as SWAP       >> 1 RISE \ i*x a b c -- i*x b a c       >> 2 RISE \ i*x a b c d -- i*x b a c d       >> etc.       >>       >>       >> Comments?       >>       >> --       >> Krishna Myneni       >>       >       >       > Since no one suggested it, in factor they have called it swapd ( x y z       > -- y x z )       >       > https://docs.factorcode.org/content/word-swapd%2Ckernel.html       >       > Using the same convention you could call it fswapd for operating on the       > floating stack.              Thanks for the suggestion. It's nice to have a word name with some       history of use.              --       KM              --- 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