#178356 - 2007-07-25 03:31 AM
Re: KiXgolf Freebie: Quicksum
[Re: Allen]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Thanks Allen very well put, and i think it was Jooel or Shawn that showed me that one, one of them might elaborate more clearly.
|
Top
|
|
|
|
#178361 - 2007-07-25 09:10 AM
Re: KiXgolf Freebie: Quicksum
[Re: Sealeopard]
|
acmp
Getting the hang of it
Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
|
Also,
($a>) = (0|$a) = ($a|)
Not sure if it's interesting but I noticed that OR behaves the same as XOR for the len() thing. No chars saved, but never mind.
_________________________
Every day is a school day
|
Top
|
|
|
|
#178372 - 2007-07-25 10:48 AM
Re: KiXgolf Freebie: Quicksum
[Re: Jochen]
|
acmp
Getting the hang of it
Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
|
Oops, Just noticed the code I pinched was not the XOR at all it was ($>). XOR would be ($^)
so, using a text string
break on
$="-1"
($|) ?
($^)
get $
returns
2 2
But if $ is an integer both OR and XOR return the value of the integer. Good job we're using strings.
_________________________
Every day is a school day
|
Top
|
|
|
|
#178392 - 2007-07-25 12:30 PM
Re: KiXgolf Freebie: Quicksum
[Re: acmp]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
acmp, Shouldn't that be $=-1 you wrote $="-1" You made it a string
Break on
$=-1
($|) ?
($^)
Get $
returns
|
Top
|
|
|
|
#178394 - 2007-07-25 12:43 PM
Re: KiXgolf Freebie: Quicksum
[Re: Witto]
|
acmp
Getting the hang of it
Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
|
Exactly.
IF a string is provided both OR and XOR return the lenght of the string, if an integer is used the value of the integer is returned.
_________________________
Every day is a school day
|
Top
|
|
|
|
#178406 - 2007-07-25 04:55 PM
Re: KiXgolf Freebie: Quicksum
[Re: Jochen]
|
acmp
Getting the hang of it
Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
|
nice test.
_________________________
Every day is a school day
|
Top
|
|
|
|
#178412 - 2007-07-25 05:36 PM
Re: KiXgolf Freebie: Quicksum
[Re: acmp]
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Have to be careful though - the algorithm will fail if there is a trailing space in the string
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 700 anonymous users online.
|
|
|