AltME: Rebol School

Messages

DocKimbel
You're still misunderstanding my sentence. I was giving instructions to PatrickP61 to change the word argument in the specification to a lit-word argument. That's all. My sentence has nothing to do with how you interpret the specification block once that change has been done.
PatrickP61
My thanks to all.  My intention was not to start any flame wars!
Ladislav
Why do you think you did?
Bo
Ladislav does not mince words.  Everyone here knows that, so we come to expect it. :-)

GiuseppeC
I have a question on Foreach:
foreach [a b] [1 2 3 4 5 6]  [
    mycode
]
how do I know in "mycode" if I am at the last couple of the serie ? (Even the knowing if I am at the start could be useful)
DocKimbel
If you need such info in the loop body, you should use FORALL instead.
GiuseppeC
But in forall I can use only one word as first argument
I have a peseudo DB and I need the extract data in groups
GiuseppeC
I suppose it is better if I use a for loop like
for idx 1 lenght? series fields-number [
    a: series/(idx*1) a: series/(idx*2)
]
And check the position.
sorry:
for idx 1 lenght? series fields-number [
    a: series/(idx*1) b: series/(idx*2)
]
And check the position.
DocKimbel
With FORALL it's much simpler, FOR is not necessary:
forall series [
    set [a b] series    ;-- a and b are set to the first two elements
    ...your code...
    series: next series ;-- advancing series by one to account for the 2nd element    
]
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!

Last message posted 187 weeks ago.