Thankyou Gabriele,

That by itself is useful to know. But, it still is different to what I was
asking.
My code was attempting to find an empty block. But not just any empty block
it was a particular empty block. But find doesn't distinguish between
particular empty blocks they look the same! Which I guess is reasonable.

Yet I can store multiple different empty blocks inside another block such
that they behave as references to blocks. Which is really handy. For example
I used this to create bookmarks in some HTML I was creating. E.g

my-html: [ <html> <body> <h1> ]
append/only my-html my-bookmark: copy []
append my-html [</h1> </body> </html>]
append my-bookmark "How to fill in after the fact with Rebol blocks"
print my-html

But I just can't use find to find those references....

my-html: [ <html> <body> <h1> ]
append/only my-html my-bookmark-1: copy []
append my-html [</h1>]
append/only my-html my-bookmark-2: copy []
append my-html [</body> </html>]

What is the index position of the block referred to by my-bookmark-2 in
my-html?
>> index? find/only my-html my-bookmark-2
== 4

Nope it got it wrong, the answer I wanted was 6.

But if I now do this
append my-bookmark-2 "Fill in the body"

and try the same question - it gets it right
>> index? find/only my-html my-bookmark-2
== 6

Brett.

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 15, 2000 10:55 PM
Subject: [REBOL] Re: Find cant find reference to block. Re:


> Hello [EMAIL PROTECTED]!
>
> On 14-Lug-00, you wrote:
>
>  G>>> find list select list 'a ; no good find can't find the
>  G>>> reference to the
>  G> block
>
> Hope this clears things up:
>
> >> find [a b c d e f g e g f h i j] [e g f]
> == [e g f h i j]
> >> find/only [a b c d e f g e g f h i j] [e g f]
> == none
> >> find/only [[a] [b]] [a]
> == [[a] [b]]
> >> find/only [[a] [b]] [b]
> == [[b]]
>
> So:
>
> >> blk: [a ["a"] b ["b"]]
> == [a ["a"] b ["b"]]
> >> select blk 'a
> == ["a"]
> >> find/only blk select blk 'a
> == [["a"] b ["b"]]
>
> But notice that that is the same as:
>
> >> next find blk 'a
> == [["a"] b ["b"]]
>
> which does one search only.
>
> Regards,
>     Gabriele.
> --
> Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
> Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
>

Reply via email to