1Array.nub(3kaya) Kaya module reference Array.nub(3kaya)
2
3
4
6 Array::nub - Remove repeated elements from a list.
7
9 Void nub( var [a] xs, Bool(a, a) eq=equal )
10
12 xs The list
13
14 eq Optionally, the equality test. Defaults to Builtins.equal (3kaya)
15
16
18 Remove repeated elements from a list in-place. Repeated elements will
19 be removed whether adjacent or not.
20
21
22 xs = [1,2,3,3,1,2,4,5,2,2,1];
23 nub(xs);
24 // xs = [1,2,3,4,5]
25
26 The name 'nub', incidentally, is borrowed from the Haskell prelude
27 function of the same name, and suggests 'essence'.
28
29 Note that the Set(3kaya) module contains types that are often more
30 suited to storing unique values
31
33 Kaya standard library by Edwin Brady, Chris Morris and others
34 (kaya@kayalang.org). For further information see http://kayalang.org/
35
37 The Kaya standard library is free software; you can redistribute it
38 and/or modify it under the terms of the GNU Lesser General Public
39 License (version 2.1 or any later version) as published by the Free
40 Software Foundation.
41
42
43
44Kaya December 2010 Array.nub(3kaya)