Problems with blocks
[1/4] from: mikaelh::delphi::se at: 2-Oct-2002 11:24
Hi,
How can I create blocks in a block like the first code snippet here
but doing it dynamically like the second exampel?
d should be the same as b.
b: make block! [["a" "b"]]
b: append b [["c" "d"]]
probe b => [["a" "b"] ["c" "d"]]
c: [["a" "b"] ["c" "d"]]
d: make block! []
foreach cc c [
d: append d cc
]
probe d => ["a" "b" "c" "d"]
/Mikael
[2/4] from: gscottjones:mchsi at: 2-Oct-2002 4:43
From: Mikael
> How can I create blocks in a block like the first code snippet here
> but doing it dynamically like the second exampel?
<<quoted lines omitted: 8>>
> ]
> probe d => ["a" "b" "c" "d"]
Hi, Mikael,
A simple refinement to append is all that is needed:
c: [["a" "b"] ["c" "d"]]
d: make block! []
foreach cc c [
append/only d cc
]
probe d
By the way, it is not necessary to reassign the result to your word, 'd.
Append appends the result to the block (or series) and returns that head as
a convenience. Using probe d will confirm that you have your result.
Hope that helps.
--Scott Jones
[3/4] from: maarten:koopmans:surfnet:nl at: 2-Oct-2002 12:12
use append/only in the second snippet
--maarten
[mikaelh--delphi--se] wrote:
> Hi,
> How can I create blocks in a block like the first code snippet here
<<quoted lines omitted: 10>>
> probe d => ["a" "b" "c" "d"]
> /Mikael
--
Maarten Koopmans
Innovation manager tel: +31 30 2 305 324
Surfnet BV fax: +31 30 2 305 329
P.O.Box 19035 email: [maarten--koopmans--surfnet--nl]
NL-3501 DA Utrecht http://www.surfnet.nl
The netherlands
[4/4] from: mikaelh:delphi:se at: 2-Oct-2002 12:22
Thanxs, exactly what I was looking for
/M
-----Ursprungligt meddelande-----
Fr=E5n: G. Scott Jones [mailto:[gscottjones--mchsi--com]]
Skickat: den 2 oktober 2002 11:44
Till: [rebol-list--rebol--com]
=C4mne: [REBOL] Re: Problems with blocks
From: Mikael
> How can I create blocks in a block like the first code snippet here
> but doing it dynamically like the second exampel?
<<quoted lines omitted: 8>>
> ]
> probe d => ["a" "b" "c" "d"]
Hi, Mikael,
A simple refinement to append is all that is needed:
c: [["a" "b"] ["c" "d"]]
d: make block! []
foreach cc c [
append/only d cc
]
probe d
By the way, it is not necessary to reassign the result to your word, 'd.
Append appends the result to the block (or series) and returns that head as
a convenience. Using probe d will confirm that you have your result.
Hope that helps.
--Scott Jones
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted