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.