[REBOL] Re: manipulating values in blocks
From: ronaldoff:free at: 28-Nov-2002 11:12
Hello Ladislav,
Thursday, November 28, 2002, 8:44:00 AM, you wrote:
LM> Hi Hugues,
>> > I manage to manipulate a block like [1 17 23 36 49 58],
>> > representing limits off segments, ie, if i have 6 values in the
>> > block, it seems that the block contains 5 segments (1-17, 17-23,
>> > 23-36 ...)
>> >
>> > is there anyone who knows how to manipulate the block into
>> > getting start and end values of each segment ? I've tried, but
>> > don't know how to do this job.
LM> the most natural way seems to be:
LM> block: [1 17 23 36 49 58]
LM> foreach [start end] block [
LM> print [start " - " end]
LM> ]
Try it with block: [1 17 23 36 49 58 66]
and you get
** Script Error: block has no value
** Where: do-boot
** Near: foreach [start end] block [
print [start " - " end]
]
Anton's script works anyway.
--
Best regards,
Ronald