----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 21, 2000 11:32 AM
Subject: [REBOL] online database manipulation


> Hi REBOLers:
>
> Among many other REBOLian projects, I am putting my ref book, THE SANDERS
> PRICE GUIDE TO AUTOGRAPHS on line. It has over 80,000 prices. Until
> REBOL/command is available and I can use mySQL, I've got the info on the
> server as a tab-delimited text file. I read it into REBOL via this
> technique:
>

Hi Ralph,

Just a small tweak for you. If the length of 'a doesn't need to be looked up
all the time in the loop, then assign it once. e.g

a-length: length? a
repeat count 10 [append b pick a (random a-length - 10))

Allen K


> a: read/lines %auto.db
>
>
> a: to-hash a
> b: []
>
>   random/seed now/time
>
>   repeat count 10 [append b pick a (random ((length? a) - 10))
>   ]
>
> You can a test of this in action (getting 10 random lookups every time
> Refresh is hit) at http://abooks.com/cgi-bin/randauto.r.
>
> My question: can anyone suggest a more efficient way to doing this?
>
> Thanks,
>
> --Ralph Roberts
> REBmeister,
> ALEXANDER BOOKS



Reply via email to