[REBOL] Re: One for the gurus ...
From: al:bri:xtra at: 1-Nov-2000 21:58
Ingo wrote:
> given the following code snippet and error message, can someone of you
figure out what went wrong here?
> foreach fld2 head current-fields [
> fld2: to-string fld2
> either pos2: find pos/2 fld2 [
> change next pos2 "txt"
> ] [
> append pos/2 compose [(fld2) "txt"]
> ]
> ]
>
> ** Script Error: either expected false-block argument of type: block.
> ** Where: fld2: to-string fld2
> either pos2:
>
> I found my error, but it took me quite some time ...
I suspect I know what it is. Here's some spoiler space:
Don't look until you can't work it out.
This line:
fld2: to-string fld2
should be:
fld2: to-string :fld2
'fld2 is most likely to be a function that takes one argument, that
argument can be a block! data-type.
> ** Script Error: either expected false-block argument of type: block.
> ** Where: fld2: to-string fld2
> either pos2:
'fld2 "consumed" the true-block argument of the 'either, on this line:
either pos2: find pos/2 fld2 [
I got bitten by a similar bug when fooling around with paths, which is
why I fixed the bug in 'append and 'repend.
Andrew Martin
ICQ: 26227169
http://members.nbci.com/AndrewMartin/