filter()

btmux-0.6-rc4/game/text/help/cat_mux/cat_functions/filter() · 782 B

From the archive btonline-btechmux-0.6-rc4.tbz2

Download the archive   « Back to the archive contents

& filter()
 
  Syntax: filter([<obj>/]<attr>, <list>[, <delim>])
 
  This function evaluates the contents of <attr> for each element of 
  <list>, passing it in as %0. A <delimiter>-separated list is 
  returned of those elements for which the evaluation returns the 
  value 1.
  
  <delimiter> may be used to specify a delimiter other than space.
 
  Example:
 
  > &IS_ODD object=mod(%0,2)
  > say filter(object/is_odd,1 2 3 4 5)
  You say "1 3 5"
 
  Note: You can pass a %q0-9 register to a function indirectly as 
  long as you don't over-write it in your filter() function.
 
  > &EXAMPLE.F object=[[setq(0,2)][filter(EXAMPLE.FIL,1 0 2 3 5 2)]
  > &EXAMPLE.FIL object=[eq(%q0,%0)]
  > say u(EXAMPLE.F)
  You say "2 2"
 
  See Also: u(), map(), fold()

Site Stats

Snippets: 1791
Codebases: 571