User talk:Yeti

From Rosetta Code
Revision as of 02:14, 27 February 2020 by Heiner (talk | contribs) (→‎Dc/Questions/DROP: added number example)

Dc/Questions/DROP

Yes, there are good ways to just delete the value at TOS.

Basically we have 2 options:

  1. use an operator, that does not push to the stack
  2. pop some register

The problem with the first option is: if we do not know whether there is a number or a string, we seem lost. If we know that TOS is a number:

0*K+k    # works only for TOS being a number

But popping a register sends all the values there (including the array) to nirvana. But what about the value we now have in TOS? It should be useful, i.e. "consumable". So, what about:

S.Os.L.o
S.Ks.L.k
S.[]s.L.P

All these should be completely side effect free, just deleting TOS. Have a nice day with it :-)
--Heiner (talk) 02:07, 27 February 2020 (UTC)