digitalmars.D - Swap operator ?
- BLS (4/4) Oct 10 2007 Not really nessesary, but nice to have...
- Jascha Wetzel (10/14) Oct 10 2007 i use:
- Matti Niemenmaa (5/9) Oct 10 2007 Or multiple return values, and then:
- Michael Gnail (2/12) Oct 11 2007 This is the *python* way, and I love that too.
- Bill Baxter (4/16) Oct 11 2007 I don't know where that syntax came from, but but I'm pretty sure it
- David Brown (3/8) Oct 11 2007 Ada doesn't have multiple assignment. CLU had it in 1974, though.
- BLS (4/8) Oct 11 2007 Sorry folks, just have recognized that this stuff is allready part of
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 == 1i 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 == 1Or 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:This is the *python* way, and I love that too.Not really nessesary, but nice to have... int a = 1; int b = 2; a <=> b // a == 2, b == 1Or multiple return values, and then: a, b = b, a;
Oct 11 2007
Michael Gnail wrote:Matti Niemenmaa wrote: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. --bbBLS wrote:This is the *python* way, and I love that too.Not really nessesary, but nice to have... int a = 1; int b = 2; a <=> b // a == 2, b == 1Or multiple return values, and then: a, b = b, a;
Oct 11 2007
On Fri, Oct 12, 2007 at 08:15:30AM +0900, Bill Baxter wrote:Ada doesn't have multiple assignment. CLU had it in 1974, though. DavidI 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.a, b = b, a;This is the *python* way, and I love that too.
Oct 11 2007
BLS schrieb:Not really nessesary, but nice to have... int a = 1; int b = 2; a <=> b // a == 2, b == 1Sorry folks, just have recognized that this stuff is allready part of the chapel thread; B
Oct 11 2007