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
> -----Original Message-----
> From: Brett Handley [SMTP:[EMAIL PROTECTED]]
> Sent: zaterdag 11 november 2000 01:37
> To: [EMAIL PROTECTED]
> Subject: [REBOL] Re: (No subject)Date: Sat, 11 Nov 2000 11:36:19
> +1100
>
> 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"
> <[EMAIL PROTECTED]>
> To: "REBOL List (E-mail)" <[EMAIL PROTECTED]>
> Sent: Tuesday, November 07, 2000 11:23 PM
> Subject: [REBOL]
>
>
> > I'm now stopped in my developping work by following problem.
> > I would like to store data into a file (on the HD) in a nested block
> > structure, but I cannot find an elegant way to compose it from raw data:
> >
> > >> b: make block! []
> > == []
> > >> append b "the-name"
> > == ["the-name"]
> > >> append b "123456"
> > == ["the-name" "123456"]
> > >> append b [123456]
> > == ["the-name" "123456" 123456]
> > >> append b ["123456"]
> > == ["the-name" "123456" 123456 "123456"]
> > >> write %_test.txt b
> > >> read %_test.txt
> > == "the-name123456123456123456"
> > >> bb: to-block read %_test.txt
> > == [the-name123456123456123456]
> >
> > When I would like to get in the file something like :
> > ["the-name" "123456" 123456 "123456"] or [["the-name"] ["123456"]
> [123456]
> > ["123456"]]
> >
> > So I can use an easy-to-follow path notation to retrieve elements
> > dynamicaly.
> >
> > Any idea ?
> >
> > Best regards ;-)
> >
> > C. COUSSEMENT
> >
> >
> >
> > --
> > To unsubscribe from this list, please send an email to
> > [EMAIL PROTECTED] with "unsubscribe" in the
> > subject, without the quotes.
> >
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.
[REBOL] Re: (No subject)Date: Sat, 11 Nov 2000 11:36:19 +1100
CRS - Psy Sel/SPO, COUSSEMENT Christophe, CPN Sun, 12 Nov 2000 23:51:24 -0800
