>Ok, that 'puzzle' from Hilmar was far too easy (took me 10 seconds, ok .. 30).
>
>Here's a nice contest. Who can write the shortest function (using native vfp functions/commands) that returns a person's age. Input is the birthday and the current date. The winner will get 3 points from me!
Here's mine! I wrote it some years ago.
lpar B,D
A=year(D)-year(B)
RETU iif(gomo(B,A*12)>D,A-1,A)
And here are the scores up until now. As I currently see it, Nadia is in the race for one point and Gibson is leader because he only needs two lines. One more day to go! Closing time 24h00 (GMT?). Who feels the urge to improve his record?
18 Nosonovsky: (well ... it does show lateral thinking!)
lpar b,d
RETU d-b
34 Yearwood: (however.. wrong)
LPAR B,D
RETU INT((D-B)/365.25)
59 Gibson:
lpar b,d
RETU floo(INT((VAL(DTOS(d))-VAL(DTOS(b))))/10000)
59 Valenca:
lpar B,D
A=year(D)-year(B)
RETU iif(gomo(B,A*12)>D,A-1,A)
72 Santerre:
LPAR B,D
RETU YEAR(D)-YEAR(b)+IIF(RIGH(DTOS(D),4)<RIGH(DTOS(b),4),-1,0)
79 Domeracki:
lpar b,d
retu year(d)-year(b)-iif((mont(d)*31)+day(d)<(mont(b)*31)+day(b),1,0)
96 Nikliodov:
lpar b,d
RETU IIF((MONT(d)*100+DAY(d))>=(MONT(b)*100+DAY(b)),YEAR(d)-YEAR(b),YEAR(d)-YEAR(b)-1)
** Alvares:
<really too long>
Groet,
Peter de Valença
Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.