Idea: swap with multiple arguments

NynnFR via Digitalmars-d digitalmars-d at puremagic.com
Tue May 24 11:05:41 PDT 2016


On Tuesday, 24 May 2016 at 14:49:20 UTC, Wyatt wrote:
> In the APL family, we have dyadic ⌽ and ⊖:
>       3⌽⍳9 ⍝ left
> 4 5 6 7 8 9 1 2 3
>       ¯3⌽⍳9 ⍝ right
> 7 8 9 1 2 3 4 5 6
[...]
> -Wyatt

Wow: I didn't see any APL code for years ! ;)
That's fine but maybe not a very good example of what should be 
or not be in D...
I agree that swap isn't a good name for a rotating operator and 
that rotateLeft / rotateRight are long names too.
And why not swap!"1342"(a, b, c, d) giving (a, c, d, b) ?


More information about the Digitalmars-d mailing list