Idea: swap with multiple arguments

Adrian Matoga via Digitalmars-d digitalmars-d at puremagic.com
Tue May 24 03:37:13 PDT 2016


On Tuesday, 24 May 2016 at 02:40:24 UTC, Observer wrote:
> As for utility, if you're a PostScript programmer, where keeping
> track of data is done via a stack-oriented model, this 
> capability
> gets used all the time, to bring relevant arguments to the top
> of the stack to be operated upon, or to shove arguments deeper
> into the stack for later use.

Forth also has "swap" and "rot". The former moves 2nd value to 
the top of the stack (i.e. a, b becomes b, a). The latter moves 
3rd value to the top (i.e. a, b, c becomes b, c, a).



More information about the Digitalmars-d mailing list