I'm working on modernizing Rosetta Code's infrastructure. Starting with communications. Please accept this time-limited open invite to RC's Slack.. --Michael Mol (talk) 20:59, 30 May 2020 (UTC)

User talk:Yeti

From Rosetta Code

Dc/Questions/DROP[edit]

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)