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

[REBOL] Block Creation Re:

From: jelinem1:nationwide at: 18-Oct-2000 8:05

The differences in your results is due to initializing the words [referencing the blocks] WITHIN the loops. Try initializing 'block1 and 'block2 outside the loops and I'll bet your results will be the same. In the case of:
>> block1: []
The word 'block1 is always set to reference the SAME block. In the case of:
>> block2: to-block ""
A DIFFERENT block is created each time. - Michael Jelinek [carl--cybercraft--co--nz] on 10/18/2000 04:13:31 AM From: [carl--cybercraft--co--nz] on 10/18/2000 04:13 AM Please respond to [list--rebol--com] To: [list--rebol--com] cc: Subject: [REBOL] Block Creation Here's a block query...
>> block1: []
== []
>> block2: to-block ""
== [] The above would appear to have created identical blocks, but as the following little script shows they're not the same... rebol [] for test1 1 5 1 [ block1: [] insert block1 "text1" ] prin "block1: " print block1 for test2 1 5 1 [ block2: to-block "" insert block2 "text2" ] prin "block2: " print block2 The output from this is... block1: text1 text1 text1 text1 text1 block2: text2 I'm assuming this is normal REBOL behaviour and not a bug, (and I know... block1: [] clear block1 would've given the same results as with to-block), but what's the point of the difference? Carl Read.