Thanks Andrew,

That is a cute solution!
Now, if we had a need for that on a continuous basis 24x7,
would it be written differently? I suppose it could be a daemon running
on some machine somewhere and would receive message requesting a number
and periodically it would write the file, thus providing a high-speed lean-resource 
implementation ?

> Dick wrote:
> > I want a unique number which is 1 greater than the last one obtained,
> worldwide.
> >
> > How do I do this in Rebol?
> 
> Rebol [
>  Name: 'Number
>  Title: "Title"
>  File: %Number.r
>  Author: "Andrew Martin"
>  eMail: [EMAIL PROTECTED]
>  Date: 17/Aug/2002
>  ]
> 
> Number: has [File Number] [
>  File: %Number.txt
>  if not exists? File [
>   save File 0
>   ]
>  Number: load File
>  Number: Number + 1
>  save File Number
>  Number
>  ]
> 
> probe Number
> probe Number
> probe Number
> probe Number
> probe Number
> probe Number
> 
> halt
> 
> Which after some tests, produced:
> 13
> 14
> 15
> 16
> 17
> 18
> 
> It's not the most optimal solution in the world (there's two 'save words for
> instance)...
> 
> You're welcome to use it as you wish.
> 
> Andrew Martin
> ICQ: 26227169 http://valley.150m.com/
> -><-
> 
> 
> -- 
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the 
> subject, without the quotes.


>** --------- End Original Message ----------- **

> 


Download NeoPlanet at http://www.neoplanet.com

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to