View unanswered posts | View active topics
|
Page 1 of 1
|
[ 11 posts ] |
|
| Author |
Message |
|
Marilla
|
Post subject: Just a little one: Arithmetic Increment/Decrement Operators? Posted: Tue Jun 27, 2006 5:39 am |
|
|
|
Not a biggie, in all honesty, but it'd be a nice little addition 
|
|
| Top |
|
 |
|
taxman
|
Post subject: Posted: Tue Jun 27, 2006 5:41 am |
|
Joined: Tue Apr 18, 2006 11:10 pm Posts: 38
|
Yeah! Let's use C 
_________________ Dream World, www.uo.od.ua
|
|
| Top |
|
 |
|
Marilla
|
Post subject: Posted: Tue Jun 27, 2006 5:51 am |
|
|
|
And while I'm at it, compound assignment, too 
|
|
| Top |
|
 |
|
Austin
|
Post subject: Posted: Tue Jun 27, 2006 6:23 am |
|
 |
| POL Developer |
 |
Joined: Wed Jan 25, 2006 2:30 am Posts: 430 Location: San Diego, California
|
|
far far far far far easier requested than granted, let me tell you..
took me a full morning just to get the >> << bit shift operators in POL.
_________________ -Austin
|
|
| Top |
|
 |
|
Marilla
|
Post subject: Posted: Tue Jun 27, 2006 6:43 am |
|
|
|
That is what I would have guessed, which is why I was careful to say it's not a big thing.. not at all. What's a few keystrokes here and there, to instead get really useful, cool features?

|
|
| Top |
|
 |
|
Austin
|
Post subject: Posted: Tue Jun 27, 2006 6:47 pm |
|
 |
| POL Developer |
 |
Joined: Wed Jan 25, 2006 2:30 am Posts: 430 Location: San Diego, California
|
|
Im just starting to get += to work...
I am testing it with RunECL
I can do
var i := 5;
i+=3;
Print ("->"+i);
and get 8
if I do i += 5+3; I get a compiler error (for now)
but i += (5+3) will work just fine..
Good things.
_________________ -Austin
|
|
| Top |
|
 |
|
Austin
|
Post subject: Posted: Wed Jun 28, 2006 1:27 am |
|
 |
| POL Developer |
 |
Joined: Wed Jan 25, 2006 2:30 am Posts: 430 Location: San Diego, California
|
Okay got this to all work properly in runecl
Code: program MathTest() var i := 5; i += 3+4; var j := array; j[1] := 3; j[1] += 5; Print("->"+i); Print("->"+j[1]); var temp := "Aust"; temp += "in"; Print("->"+temp); return 1; endprogram
So += -= and such could be a very real possibility in 097.
Gimme some other stuff you would throw at it (only += is in right now) to test...!
_________________ -Austin
|
|
| Top |
|
 |
|
Marilla
|
Post subject: Posted: Wed Jun 28, 2006 2:51 am |
|
|
|
Schweet lookin'...
Only other things I could think of to test out would be:
Code: program Test(who) var s := struct; s.+z := 0; s.+z_mod := 5;
s.z += 5; s.z += s.z_mod;
s.z += "what will this do?"; s.z += who; // this, too, just to know. who.color += 1; endprogram
So, just basically making sure it would all work as expected with structs (and dictionaries, of course), and object members, and also to make sure that adding different types of data doesn't throw monkey wrenches into things. 
|
|
| Top |
|
 |
|
Austin
|
Post subject: Posted: Wed Jun 28, 2006 3:06 am |
|
 |
| POL Developer |
 |
Joined: Wed Jan 25, 2006 2:30 am Posts: 430 Location: San Diego, California
|
Okay heres what I tested in the first code block.
The second is the output given.
Code: program MathTest() PlusEqualTests(); MinusEqualTests(); endprogram
function PlusEqualTests() Print("\nPlusEqual Tests()"); var a := 1; a += 2; Print("A->"+a); var b := 1; b+= 4+3; Print("B->"+b); var c := array{1}; c[1] += 3; Print("C->"+c); var d := array{"A"}; var e := array{"B"}; d+=e; Print("D->"+d); var f := struct; f.+A := 1; f.A+=3; Print("F.A->"+f.A); var g := "PO"; g+="L"; Print("G->"+g); var h; for ( h:=0; h<=2; h+=1 ) print("H->"+h); endfor var i := dictionary; i["A"] := 1; i["A"] += 3; Print("i['A']->"+i["A"]); return 1; endfunction
function MinusEqualTests() Print("\nMinusEqual Tests()"); var a := 3; a -= 2; Print("A->"+a); var b := 4; b-= 3-1; Print("B->"+b); var c := array{5}; c[1] -= 3; Print("C->"+c); var d := array{"A", {"B"}}; var e := array{"B"}; d-=e; Print("D->"+d); var f := struct; f.+A := 7; f.A-=3; Print("F.A->"+f.A); var g := "POLLL"; g-="LL"; Print("G->"+g); var h; for ( h:=3; h>=0; h-=1 ) print("H->"+h); endfor var i := dictionary; i["A"] := 4; i["A"] -= 3; Print("i['A']->"+i["A"]); return 1; endfunction
Code: PlusEqual Tests() A->3 B->8 C->{ 4 } D->{ A, { B } } F.A->4 G->POL H->0 H->1 H->2 i['A']->4
MinusEqual Tests() A->1 B->2 C->{ 2 } D->{ A, { B } } F.A->4 G->POL H->3 H->2 H->1 H->0 i['A']->1
_________________ -Austin
|
|
| Top |
|
 |
|
Austin
|
Post subject: Posted: Thu Jun 29, 2006 12:06 am |
|
 |
| POL Developer |
 |
Joined: Wed Jan 25, 2006 2:30 am Posts: 430 Location: San Diego, California
|
|
Okay your wish was granted, we got += -= *= /= and %=
Note: No one ask for i++ ++i i-- --i for a while, thats a whole 'nother story.
Also I went into POL ( I did most my testing in RunECL ) I disabled all the packages except for what was required.. and then did two for loops that started at 0 and counted to 10000
i := i+1 took 30 ms
i += 1 took 20 ms.
_________________ -Austin
|
|
| Top |
|
 |
|
Marilla
|
Post subject: Posted: Thu Jun 29, 2006 1:18 am |
|
|
|
Well, now; isn't that peachy!

|
|
| Top |
|
 |
|
Page 1 of 1
|
[ 11 posts ] |
|
Who is online |
Users browsing this forum: Yahoo [Bot] and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|