]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE section PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" | |
3 | "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd"> | |
4 | ||
5 | <section id="bbv2.reference.modules.sequence"> | |
6 | ||
7 | <title>sequence</title> | |
8 | <indexterm> | |
9 | <primary>sequence</primary> | |
10 | <secondary>module</secondary> | |
11 | </indexterm> | |
12 | ||
13 | <para> | |
14 | Various useful list functions. Note that algorithms in this module | |
15 | execute largely in the caller's module namespace, so that local | |
16 | rules can be used as function objects. Also note that most predicates | |
17 | can be multi-element lists. In that case, all but the first element | |
18 | are prepended to the first argument which is passed to the rule named | |
19 | by the first element. | |
20 | </para> | |
21 | ||
22 | <orderedlist> | |
23 | ||
24 | <listitem id="bbv2.reference.modules.sequence.filter"> | |
25 | <indexterm zone="bbv2.reference.modules.sequence.filter"> | |
26 | <primary>filter</primary> | |
27 | <secondary>sequence</secondary> | |
28 | </indexterm> | |
29 | <code language="jam">rule filter ( predicate + : sequence * )</code> | |
30 | <para>Return the elements <code language="jam">e</code> of | |
31 | <code language="jam">$(sequence)</code> for which | |
32 | <code language="jam">[ $(predicate) e ]</code> has a non-null value. | |
33 | </para> | |
34 | </listitem> | |
35 | ||
36 | <listitem id="bbv2.reference.modules.sequence.transform"> | |
37 | <indexterm zone="bbv2.reference.modules.sequence.transform"> | |
38 | <primary>transform</primary> | |
39 | <secondary>sequence</secondary> | |
40 | </indexterm> | |
41 | <code language="jam">rule transform ( function + : sequence * )</code> | |
42 | <para>Return a new sequence consisting of | |
43 | <code language="jam">[ $(function) $(e) ]</code> for each element | |
44 | <code language="jam">e</code> of <code language="jam">$(sequence)</code>. | |
45 | </para> | |
46 | </listitem> | |
47 | ||
48 | <listitem id="bbv2.reference.modules.sequence.reverse"> | |
49 | <indexterm zone="bbv2.reference.modules.sequence.reverse"> | |
50 | <primary>reverse</primary> | |
51 | <secondary>sequence</secondary> | |
52 | </indexterm> | |
53 | <code language="jam">rule reverse ( s * )</code> | |
54 | <para>Returns the elements of <code language="jam">s</code> in | |
55 | reverse order.</para> | |
56 | </listitem> | |
57 | ||
58 | <listitem id="bbv2.reference.modules.sequence.insertion-sort"> | |
59 | <indexterm zone="bbv2.reference.modules.sequence.insertion-sort"> | |
60 | <primary>insertion-sort</primary> | |
61 | <secondary>sequence</secondary> | |
62 | </indexterm> | |
63 | <code language="jam">rule insertion-sort ( s * : ordered * )</code> | |
64 | <para>Insertion-sort <code language="jam">s</code> using the | |
65 | BinaryPredicate <code language="jam">ordered</code>.</para> | |
66 | </listitem> | |
67 | ||
68 | <listitem id="bbv2.reference.modules.sequence.merge"> | |
69 | <indexterm zone="bbv2.reference.modules.sequence.merge"> | |
70 | <primary>merge</primary> | |
71 | <secondary>sequence</secondary> | |
72 | </indexterm> | |
73 | <code language="jam">rule merge ( s1 * : s2 * : ordered * )</code> | |
74 | <para>Merge two ordered sequences using the BinaryPredicate | |
75 | <code language="jam">ordered</code>.</para> | |
76 | </listitem> | |
77 | ||
78 | <listitem id="bbv2.reference.modules.sequence.join"> | |
79 | <indexterm zone="bbv2.reference.modules.sequence.join"> | |
80 | <primary>join</primary> | |
81 | <secondary>sequence</secondary> | |
82 | </indexterm> | |
83 | <code language="jam">rule join ( s * : joint ? )</code> | |
84 | <para>Join the elements of <code language="jam">s</code> into one | |
85 | long string. If <code language="jam">joint</code> is supplied, it | |
86 | is used as a separator.</para> | |
87 | </listitem> | |
88 | ||
89 | <listitem id="bbv2.reference.modules.sequence.length"> | |
90 | <indexterm zone="bbv2.reference.modules.sequence.length"> | |
91 | <primary>length</primary> | |
92 | <secondary>sequence</secondary> | |
93 | </indexterm> | |
94 | <code language="jam">rule length ( s * )</code> | |
95 | <para>Find the length of any sequence.</para> | |
96 | </listitem> | |
97 | ||
98 | <listitem id="bbv2.reference.modules.sequence.unique"> | |
99 | <indexterm zone="bbv2.reference.modules.sequence.unique"> | |
100 | <primary>unique</primary> | |
101 | <secondary>sequence</secondary> | |
102 | </indexterm> | |
103 | <code language="jam">rule unique ( list * : stable ? )</code> | |
104 | <para>Removes duplicates from <code language="jam">list</code>. | |
105 | If <code language="jam">stable</code> is passed, then the order | |
106 | of the elements will be unchanged.</para> | |
107 | </listitem> | |
108 | ||
109 | <listitem id="bbv2.reference.modules.sequence.max-element"> | |
110 | <indexterm zone="bbv2.reference.modules.sequence.max-element"> | |
111 | <primary>max-element</primary> | |
112 | <secondary>sequence</secondary> | |
113 | </indexterm> | |
114 | <code language="jam">rule max-element ( elements + : ordered ? )</code> | |
115 | <para>Returns the maximum number in <code language="jam">elements</code>. | |
116 | Uses <code language="jam">ordered</code> for comparisons or | |
117 | <link linkend="bbv2.reference.modules.numbers.less">numbers.less</link> | |
118 | if none is provided.</para> | |
119 | </listitem> | |
120 | ||
121 | <listitem id="bbv2.reference.modules.sequence.select-highest-ranked"> | |
122 | <indexterm zone="bbv2.reference.modules.sequence.select-highest-ranked"> | |
123 | <primary>select-highest-ranked</primary> | |
124 | <secondary>sequence</secondary> | |
125 | </indexterm> | |
126 | <code language="jam">rule select-highest-ranked ( elements * : ranks * )</code> | |
127 | <para>Returns all of <code language="jam">elements</code> for which | |
128 | the corresponding element in the parallel list | |
129 | <code language="jam">rank</code> is equal to the maximum value in | |
130 | <code language="jam">rank</code>.</para> | |
131 | </listitem> | |
132 | ||
133 | </orderedlist> | |
134 | ||
135 | </section> |