More likely you meant this...

I've seen
farm: [
   "bob"    "cecil"
   "bill"      "chris"
   "barry"  "curtis"
]
foreach [pig chicken] farm [print reduce [pig chicken]]

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 19, 2000 10:45 PM
Subject: [REBOL] simple foreach question Re:(2)


>
> The nice thing about foreach is that you can also parse your block
> into more than than one word (variable):
>
> farm: [[pigs] [chickens]]
>
> foreach [pig chicken] farm [print [pig chicken]]
>
> > Boss is going to please with you aint 'e?
>
> > "page" is being defined by the foreach.
>
> > So for each element in the block "pages" foreach will set the word page
to
> > the value of that element - it then
> > does the body block with that value.
>
> > You can use whatever you want:
> > foreach qwrtyuiop ["one" "two" "three"] [print qwrtyuiop]
> > Note that qwrtyuiop only has a value in the body block.
>
> > see:
> >>> help foreach
> > USAGE:
> >     FOREACH 'word data body
>
> > DESCRIPTION:
> >      Evaluates a block for each value(s) in a series.
> >      FOREACH is a native value.
>
> > ARGUMENTS:
> >      word -- Word or block of words to set each time (will be local)
(Type:
> > get-wor
> > d word block)
> >      data -- The series to traverse (Type: series)
> >      body -- Block to evaluate each time (Type: block)
>
> > Brett.
>
> > ----- Original Message -----
> > From: <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, July 19, 2000 4:26 AM
> > Subject: [REBOL] simple foreach question
>
>
> >> howdy guys,
> >>
> >> I'm on a roll, just trying to "get" simple things. for instance, in
> >> the exapmle,
> >>
> >> pages: [ http://www.cnet.com
> >>        http://www.rebol.com/index.html
> >>        http://www.news-wire.com/news/today.html ]
> >>
> >>  loop 24 [ foreach page pages [send [EMAIL PROTECTED] read page] wait 1:00
> >>  ]
> >>
> >> where did "page" come from? is it arbitrary?  if the block was of
species
> > of
> >> pigs, would it be "foreach pig pigs?
> >>
> >> just curious.  Let me know if I get annoying.
> >>
> >>
> >> --
> >>
> >> Eat more spinach.
> >> -tom
> >>
>
>
> --
> [EMAIL PROTECTED]
> http://perso.worldonline.fr/mutant
>
>
>

Reply via email to