AltME: Rebol School

Messages

DocKimbel
FORALL will already advance the series by one position when looping, so you just need to manually skip the extra element that you read with SET.
GiuseppeC
Lets assume we have 8 fields:
numfields: 8
forall series [
    set [a b c d e f g h i ] series
    series: skip series numfields  - 1
]
Is it right ?
DocKimbel
Exactly.
GiuseppeC
Thanks doc !
DocKimbel
You can also do it with FORSKIP which will do the series advancement for you:
forskip series 8 [
    set [a b c d e f g h i ] series
    ...
]
GiuseppeC
... retaining the ability to read the series index ...
DocKimbel
Yep. Now, you know how to use both FORALL and FORSKIP. The advantage of FORALL is that it lets you have full control over how to process the series. FORSKIP is more convenient when you need to process the series with fixed sized records.
GiuseppeC
In fact I will use Forskip as I am processing a DB like series.
DocKimbel
Looks like the best option for your use case.
amacleod
Simplest way to remove a block from a block of blocks?
a: [[A] [B] [C]]
== [[A] [B] [C]]
>> remove third a
== []
>> a
== [[A] [B] []]
...but I want the block removed too!
Josh
>> a: [[A] [B] [C]]
== [[A] [B] [C]]
>> third a
== [C]
(that is a hint)
>> head remove next next [[A] [B] [C]]
== [[A] [B]]
Gregg
As Josh hinted, THIRD is returning the third element, which REMOVE then operates on. You'll want to use AT, or something, to remove the element. e.g.
>> a: [[A] [B] [C]]
== [[A] [B] [C]]
>> head remove at a 3
== [[A] [B]]
>> a: [[A] [B] [C]]
== [[A] [B] [C]]
>> head remove find/only a [c]
== [[A] [B]]
amacleod
head remove find/only a [c]
this is exactly what I need....
"at" ...new to me!
Thanks all!
Greg,
remove find/only a [c]
seems to work too, without head...
Gregg
Yes, as long as you don't need the result to be at the head.
>> a: [[A] [B] [C]]
== [[A] [B] [C]]
>> remove find/only a [c]
== []
I just included HEAD to make the result clear in this case.
amacleod
I see...I would want that result with head...thanks

GiuseppeC
Hope there is someone here in the morning as I need quick help:

Last message posted 184 weeks ago.