Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Newbie Q: Search and delete from a Block

From: al:bri:xtra at: 4-Oct-2002 8:51

Matt wrote:
> 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"] >> help remove-each
USAGE: REMOVE-EACH 'word data body DESCRIPTION: Removes a value from a series for each block that returns TRUE. REMOVE-EACH is a native value. ARGUMENTS: word -- Word or block of words to set each time (will be local) (Type: get-word word b lock) data -- The series to traverse (Type: series) body -- Block to evaluate. Return TRUE to remove. (Type: block)
>> remove-each Item X: ["hello" "there" "this" "is" "an" "Example"] [Item this
] == ["hello" "there" "is" "an" "Example"]
>> probe X
["hello" "there" "is" "an" "Example"] == ["hello" "there" "is" "an" "Example"] Andrew Martin ICQ: 26227169 http://valley.150m.com/