[EMAIL PROTECTED] wrote:
> It takes me awhile sometimes...
> But can someone give me an example of how bind is useful please?
One real life example. One of our older report generators produced some
reports and my boss wanted to get it into Lotus 1-2-3 (equivalent of
Excel). I was asked for removal of unwanted lines (column headers, etc.)
So I created following script on the fly directly in console and than
decided to abstract it a little bit and save for later usage:
REBOL []
; remove unwanted portions of text file
file: read/lines %some-file.txt
result: copy []
what-not: [
empty? trim/all copy line
found? find trim/all copy line "WEIGHTNAMEOFPRODUCT"
found? find radek "======="
(to-char first radek) = (to-char 12)
]
foreach line file [if not any bind what-not 'line [insert tail result
line]]
write/lines %result.txt result
'what-not contains 'line word, but can't understand it, as it has no
value assigned. We are using 'what-not block inside of foreach loop, and
we wan to "bind" 'what-not's context 'line word to that of 'foreach
loop. Or something like that :-)
-pekr-
>
>
> Thanks.
> Brett.