#178269 - 2007-07-23 10:41 PM
Re: KiXgolf Freebie: Quicksum
[Re: Gargoyle]
|
acmp
Getting the hang of it
Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
|
I have so much to learn. What fun tomorrow will be.
_________________________
Every day is a school day
|
Top
|
|
|
|
#178274 - 2007-07-24 12:05 AM
Re: KiXgolf Freebie: Quicksum
[Re: Lonkero]
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4549
Loc: USA
|
Your understanding of math/programming is well beyond mine... no doubt about it.
I guess I could see what you mean about infinity, but I guess I would never see how it is a positive increment. 0 is less than 1 (I think anyway )
|
Top
|
|
|
|
#178275 - 2007-07-24 01:41 AM
Re: KiXgolf Freebie: Quicksum
[Re: Allen]
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
well, positive increment it is if I don't specify negative step, right? so, it doesn't matter what is the final number, it will count positively.
now, you wonder why I expect it to come back to zero at some point? that's because once it reaches 2 147 483 647, it can't add no more numbers, it's the limit. thus, adding one more to that will result in -2 147 483 647 and -2 147 483 646 after that, until it would reach zero.
anyway, like said, it doesn't matter what is the X in "to X", kix should always keep on incrementing until it hits that value. and as 0 is smaller than the starting number of 1, it should just keep on looping. approx. 4 294 967 294 times to be exact.
_________________________
!download KiXnet
|
Top
|
|
|
|
#178284 - 2007-07-24 08:27 AM
Re: KiXgolf Freebie: Quicksum
[Re: Benny69]
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
Top
|
|
|
|
#178289 - 2007-07-24 09:32 AM
Re: KiXgolf Freebie: Quicksum
[Re: Jochen]
|
acmp
Getting the hang of it
Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
|
Here's my 81
Function a($b)
Dim $, $w
For $ = 1 to 255
$w=Asc(SubStr($b,$))-64
if $w>0 $a=$a+$w*$
EndFunction
I've really got to get my head around these recursive function calls to see if it can be improved. You chaps have some mean tricks up your sleeves.
Edited by acmp (2007-07-24 09:47 AM) Edit Reason: oops, mis stated $w>0
_________________________
Every day is a school day
|
Top
|
|
|
|
#178290 - 2007-07-24 09:42 AM
Re: KiXgolf Freebie: Quicksum
[Re: acmp]
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Benny's code reduced to 78
Hey Jooel - no DIM
Function a($)
if $
$a=asc(right($,1))-64
$a=a(left($,~))+len($)*$a*($a>)
EndFunction
|
Top
|
|
|
|
#178293 - 2007-07-24 10:10 AM
Re: KiXgolf Freebie: Quicksum
[Re: Jochen]
|
acmp
Getting the hang of it
Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
|
Jochen,
Rule 12: 12) Parameter names of the UDF's can be changed and additional optional parameters can be added.
Go for it.
_________________________
Every day is a school day
|
Top
|
|
|
|
#178297 - 2007-07-24 10:28 AM
Re: KiXgolf Freebie: Quicksum
[Re: Jochen]
|
acmp
Getting the hang of it
Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
|
Jochen, What is the $>! doing?
And, is there anywhere where these tricks are documented?
_________________________
Every day is a school day
|
Top
|
|
|
|
#178304 - 2007-07-24 10:55 AM
Re: KiXgolf Freebie: Quicksum
[Re: acmp]
|
acmp
Getting the hang of it
Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
|
'coz it is cheating!
_________________________
Every day is a school day
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 700 anonymous users online.
|
|
|