Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

How to make fast timestamped dictionaries ?

 [1/5] from: jasonic::cunliffe::verizon::net at: 2-Jan-2002 12:13


Apologies as I'm sure this has been covered already somewhere.. I need a timestamped dictionary:
>> dict: make hash! 1024
== make hash! []
>> insert tail dict [now/precise "making dictionaries is what we do"]
== make hash! []
>> insert tail dict [now/precise "Life is only good when well written"]
== make hash! []
>> dict
== make hash! [now/precise "making dictionaries is what we do" now/precise Life is only good when well written ] Q1: How do I get now/precise to be valuated at the same time I do the insert? ie returns 2-Jan-2002/11:48:00.00-5:00 "making dictionaries is what we do" 2-Jan-2002/11:51:49.84-5:00 "Life is only good when well written" Q2: What do you suggest would most efficient REBOL structure for timestamped key lookups when there is large amount of data? Is hash! the fastest way to go? Should entries be paired up in sub-blocks: [timestamp data][timestamp data][timestamp data]..? Q3: If my entries are not text/data strings but REBOL words, functions etc, what methods do you suggest to eroor test and evaluate them, need to acess them in a foreach loop or find timestamp? thanks ./Jason

 [2/5] from: al:bri:xtra at: 3-Jan-2002 11:19


Current Directory Jason wrote:
> Q1: How do I get now/precise to be valuated at the same time I do the
insert?
> ie returns > > 2-Jan-2002/11:48:00.00-5:00 "making dictionaries is what we do" > 2-Jan-2002/11:51:49.84-5:00 "Life is only good when well written"
Try: insert tail dict reduce [now/precise "making dictionaries is what we do"] insert tail dict reduce [now/precise "Life is only good when well written"] I'm not sure what you mean by your other questions. Andrew Martin ICQ: 26227169 http://valley.150m.com/

 [3/5] from: ammonjohnson:y:ahoo at: 2-Jan-2002 16:51


As simple as:
>> insert tail dict reduce [(now/precise) "Life is only good when well
written"] A block is never evaluated unless you pass it to a function that evaluates it. ;-) Look at the following functions: Reduce Rejoin Compose HTH Ammon

 [4/5] from: al:bri:xtra at: 3-Jan-2002 12:29


And an even better and quicker way is: repend dict [now/precise "Your text string here!"] Andrew Martin ICQ: 26227169 http://valley.150m.com/

 [5/5] from: jasonic:cunliffe:verizon at: 2-Jan-2002 19:39


>> insert tail dict reduce [(now/precise) "Life is only good when well
written"] [doh] thanks!
> And an even better and quicker way is: > repend dict [now/precise "Your text string here!"]
aha yes nice. I wondered what repend was for. thanks everyone ./Jason