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

(No subject)Date: Sat, 11 Nov 2000 11:36:19 +1100

 [1/2] from: brett::codeconscious::com at: 10-Nov-2000 16:36


Hi, Saving your data Consider using the SAVE function or the MOLD function. Type HELP SAVE at the console.
>> a: ["the-name" "123456" 123456 "123456"]
== ["the-name" "123456" 123456 "123456"]
>> save %tf.txt a >> a-retrieved: load %tf.txt
== ["the-name" "123456" 123456 "123456" ]
>> equal? a a-retrieved
== true
>> b: [["the-name"] ["123456"] [123456] ["123456"]]
== [["the-name"] ["123456"] [123456] ["123456"]]
>> save %b.txt b >> b-retrieved: load %b.txt
== [["the-name"] ["123456"] [123456] ["123456"] ]
>> equal? b b-retrieved
== true Creating your data You mentioned composing it - did you try looking at the COMPOSE function - nay be useful to you. Here's a bunch of lines that might inspire some ideas.
>> c: copy []
== []
>> append c "a string"
== ["a string"]
>> append/only c reduce ["string in a nested block"]
== ["a string" ["string in a nested block"]]
>> reference-to-a-block: copy/deep c
== ["a string" ["string in a nested block"]]
>> append/only c reference-to-a-block
== ["a string" ["string in a nested block"] ["a string" ["string in a nested block"]]]
>> append reference-to-a-block "Appended into the block."
== ["a string" ["string in a nested block"] "Appended into the block."]
>> c
== ["a string" ["string in a nested block"] ["a string" ["string in a nested block"] "Appended in to the block."]] In regards to structuring the data. I think it really depends on how you want to update and access it. Some structures are easier to create and harder to read, others harder to create and easier to read. It really depends on what you are doing. That said, having a favourite structure can be useful too, because then multiple programs can pass it around and work on it. Hope it helps. Brett. ----- Original Message ----- From: "CRS - Psy Sel/SPO, COUSSEMENT Christophe, CPN" <[COUSSEMENT--C--ITC--mil--be]>

 [2/2] from: coussement:c:itc:mil:be at: 13-Nov-2000 8:48


Brett: Thanks for the hints. I finally found the right and efficent way to meet my requirements. Here is a sample of the code, it might help someone with the same problem : if not exists? db-file [save db-file []] db: load db-file ;--- create an entry for a if not exists --- if none? select db a-id [ append db reduce [a-id reduce [c-date]] ] ;--- create an entry for t for the a if not exists --- if none? select select db a-id t-id[ append select db a-id reduce [t-id[]] ] ;--- if an exists, replace it by new else write it down --- either none? pick select select db a-id t-id q-id [ ;--- write an-id --- append/only select select db a-id t-id reduce [an-id an-time] ][ ;--- replace an-id --- change pick select select db a-id t-id q-id reduce [an-id an-time] ] ;--- save to disk --- save db-file db Best regards, C. COUSSEMENT