TU-Berlin → Inst. f. Mathematik → Algebra und Zahlentheorie → KASH → Documentation → Reference Manual
KASH3 Reference Manual
search    

Function

First ( func pred ) -> func fir

Optional Arguments

FailanyDetermines what to return in case of failure.

Description

Construct a functional `fir(<list> l) -> any' which finds and returns the first element which suffices the predicate function `pred' and returns it.
Note: Apparently `pred' must have `-> elt-alg^boo' out-signature.

Examples

l:=[Random(1000)..1000+Random(1000)]; f:=First(i->i mod 17=0); l; f(l);

Built: Mon Nov 14 21:12:39 UTC 2005 on mack
The KANT Group