hi: you've to work in two times: 1. find the word 2. remove it from the block
We can thus use the function "find" (to get a definition of it, type ? find in the console). If found, "Find" will return the word followed by the following words, either none if not found: >> find ["hello" "there" "this" "is" "an" "Example"] "this" == ["this" "is" "an" "Example"] >> We have then to remove the first element of this block, by using the function "remove": >> remove ["this" "is" "an" "Example"] == ["is" "an" "Example"] >> Because REBOL is the champion of the oneliners, we can write: >> remove find ["hello" "there" "this" "is" "an" "Example"] "this" == ["is" "an" "Example"] >> Ok, but now we cannot see what's before "is", and we should put it at the head of the block... so we have to address it: >> my-block: ["hello" "there" "this" "is" "an" "Example"] == ["hello" "there" "this" "is" "an" "Example"] >> remove find my-block "this" == ["is" "an" "Example"] >> my-block == ["hello" "there" "is" "an" "Example"] >> Or put the pointer of the block to the head of it: >> head remove find ["hello" "there" "this" "is" "an" "Example"] "this" == ["hello" "there" "is" "an" "Example"] >> Hope this helps ! ==christophe > -----Original Message----- > From: Matthew Kim [SMTP:[EMAIL PROTECTED]] > Sent: 03 Oct 02 20:28 > To: [EMAIL PROTECTED] > Subject: [REBOL] Newbie Q: Search and delete from a Block > > A simple question... > > How do I go about searching and deleting from a block? > > Ex. > > ["hello" "there" "this" "is" "an" "Example"] > > I want to search for "this" and delete it to result with: > > ["hello" "there" "is" "an" "Example"] > > Thanks! > Matt > > -- > To unsubscribe from this list, please send an email to > [EMAIL PROTECTED] with "unsubscribe" in the > subject, without the quotes. > -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
