digitalmars.D - Swap operator ?
- BLS <nanali nospam-wanadoo.fr> Oct 10 2007
- Jascha Wetzel <firstname mainia.de> Oct 10 2007
- Matti Niemenmaa <see_signature for.real.address> Oct 10 2007
- Michael Gnail <gnail.f gmail.com> Oct 11 2007
- Bill Baxter <dnewsgroup billbaxter.com> Oct 11 2007
- David Brown <dlang davidb.org> Oct 11 2007
- BLS <nanali nospam-wanadoo.fr> Oct 11 2007
Not really nessesary, but nice to have... int a = 1; int b = 2; a <=> b // a == 2, b == 1
Oct 10 2007
BLS wrote:Not really nessesary, but nice to have... int a = 1; int b = 2; a <=> b // a == 2, b == 1
i use: void swap(T)(ref T a, ref T b) { T t = a; a = b; b = t; } int a = 1; int b = 2; swap(a,b);
Oct 10 2007
BLS wrote:Not really nessesary, but nice to have... int a = 1; int b = 2; a <=> b // a == 2, b == 1
Or multiple return values, and then: a, b = b, a; -- E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi
Oct 10 2007
Matti Niemenmaa wrote:BLS wrote:Not really nessesary, but nice to have... int a = 1; int b = 2; a <=> b // a == 2, b == 1
Or multiple return values, and then: a, b = b, a;
Oct 11 2007
Michael Gnail wrote:Matti Niemenmaa wrote:BLS wrote:Not really nessesary, but nice to have... int a = 1; int b = 2; a <=> b // a == 2, b == 1
Or multiple return values, and then: a, b = b, a;
I don't know where that syntax came from, but but I'm pretty sure it predates python by a good bit. Probably Ada or something. --bb
Oct 11 2007
On Fri, Oct 12, 2007 at 08:15:30AM +0900, Bill Baxter wrote:a, b = b, a;
I don't know where that syntax came from, but but I'm pretty sure it predates python by a good bit. Probably Ada or something.
Ada doesn't have multiple assignment. CLU had it in 1974, though. David
Oct 11 2007
BLS schrieb:Not really nessesary, but nice to have... int a = 1; int b = 2; a <=> b // a == 2, b == 1
Sorry folks, just have recognized that this stuff is allready part of the chapel thread; B
Oct 11 2007









Jascha Wetzel <firstname mainia.de> 