1Array.filter(3kaya)          Kaya module reference         Array.filter(3kaya)
2
3
4

NAME

6       Array::filter - Filter a list according to a predicate.
7

SYNOPSIS

9       [a] filter( Bool(a) p, [a] xs )
10

ARGUMENTS

12       p The predicate to test against
13
14       xs The array to filter
15

DESCRIPTION

17       Each element of xs is tested against the predicate p
18
19       The returned list contains those elements of xs for which the predicate
20       is true. The predicate function may of course be partially applied  for
21       ease of programming.
22
23
24    Bool isDiv(Int d,Int a) {
25        return (a%d==0);
26    }
27
28    Void main() {
29        ints = [1,2,3,4,5,6,7,8];
30        odds = filter(isDiv@(3),ints);
31        // odds = [3,6];
32    }
33

AUTHORS

35       Kaya   standard  library  by  Edwin  Brady,  Chris  Morris  and  others
36       (kaya@kayalang.org). For further information see http://kayalang.org/
37

LICENSE

39       The Kaya standard library is free software;  you  can  redistribute  it
40       and/or  modify  it  under  the  terms  of the GNU Lesser General Public
41       License (version 2.1 or any later version) as  published  by  the  Free
42       Software Foundation.
43
45       Array.any (3kaya)
46       Array.all (3kaya)
47
48
49
50Kaya                             December 2010             Array.filter(3kaya)
Impressum