Hi, Miquel,

Miquel Gaya wrote:
> 
> but if I want generalize the foreach expression...
> 
> >> row: [ a b c d e ]
> == [a b c d e]
> >> foreach row data [ print row ]
> 1
> AAA
> BBB
...
> DDD
> VVV
> 2
> 1
> >>
> 
> row is considered a word, not a block.
> How can I use foreach with a block ?
> 

Depending on what you want to do inside the repeated block...

    >> rowlength: 5
    == 5
    >> s: data
    == [1 AAA BBB 3 0
        2 MMM XXX 1 1
        3 DDD VVV 2 1]
    >> forskip s rowlength [print [copy/part s rowlength]]
    1 AAA BBB 3 0
    2 MMM XXX 1 1
    3 DDD VVV 2 1
    == false

-jn-

-- 
; sub REBOL {}; sub head ($) {@_[0]}
REBOL []
# despam: func [e] [replace replace/all e ":" "." "#" "@"]
; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"}
print head reverse despam "moc:xedef#yleen:leoj" ;
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to