Debian Codegraph @

doc/lib/component-list-child-number.html

raw
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >component-list-child-number</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
9 REL="HOME"
10 TITLE="DSSSL Library Reference"
11 HREF="index.html"><LINK
12 REL="UP"
13 TITLE="Miscellaneous"
14 HREF="r300.htm"><LINK
15 REL="PREVIOUS"
16 TITLE="component-list-descendant-node-list"
17 HREF="component-descendant-list-node-list.html"><LINK
18 REL="NEXT"
19 TITLE="expt"
20 HREF="expt.html"></HEAD
21 ><BODY
22 CLASS="REFENTRY"
23 BGCOLOR="#FFFFFF"
24 TEXT="#000000"
25 LINK="#0000FF"
26 VLINK="#840084"
27 ALINK="#0000FF"
28 ><DIV
29 CLASS="NAVHEADER"
30 ><TABLE
31 SUMMARY="Header navigation table"
32 WIDTH="100%"
33 BORDER="0"
34 CELLPADDING="0"
35 CELLSPACING="0"
36 ><TR
37 ><TH
38 COLSPAN="3"
39 ALIGN="center"
40 >DSSSL Library Reference: Part of the Modular DocBook Stylesheet distribution</TH
41 ></TR
42 ><TR
43 ><TD
44 WIDTH="10%"
45 ALIGN="left"
46 VALIGN="bottom"
47 ><A
48 HREF="component-descendant-list-node-list.html"
49 ACCESSKEY="P"
50 >Prev</A
51 ></TD
52 ><TD
53 WIDTH="80%"
54 ALIGN="center"
55 VALIGN="bottom"
56 ></TD
57 ><TD
58 WIDTH="10%"
59 ALIGN="right"
60 VALIGN="bottom"
61 ><A
62 HREF="expt.html"
63 ACCESSKEY="N"
64 >Next</A
65 ></TD
66 ></TR
67 ></TABLE
68 ><HR
69 ALIGN="LEFT"
70 WIDTH="100%"></DIV
71 ><H1
72 ><A
73 NAME="COMPONENT-LIST-CHILD-NUMBER"
74 ></A
75 >component-list-child-number</H1
76 ><DIV
77 CLASS="REFNAMEDIV"
78 ><A
79 NAME="AEN1217"
80 ></A
81 ><H2
82 >Name</H2
83 >component-list-child-number&nbsp;--&nbsp;Find child-number of a list of children within a component</DIV
84 ><DIV
85 CLASS="REFSYNOPSISDIV"
86 ><A
87 NAME="AEN1220"
88 ></A
89 ><H2
90 >Synopsis</H2
91 ><PRE
92 CLASS="SYNOPSIS"
93 >(component-list-child-number inputnd inputlist complist)</PRE
94 ></DIV
95 ><DIV
96 CLASS="REFSECT1"
97 ><A
98 NAME="AEN1223"
99 ></A
100 ><H2
101 >Description</H2
102 ><P
103 >Finds the first ancestor of <TT
104 CLASS="LITERAL"
105 >inputnd</TT
106 > in <TT
107 CLASS="LITERAL"
108 >complist</TT
109 > and
110 then counts all the elements of the types in <TT
111 CLASS="LITERAL"
112 >inputlist</TT
113 >
114 from that point on and returns the number of <TT
115 CLASS="LITERAL"
116 >inputnd</TT
117 >.</P
118 ><P
119 >If the node is not found, 0 is returned.</P
120 ><P
121 >WARNING: this requires walking over *all* the descendants
122 of the ancestor node. This may be *slow*.</P
123 ></DIV
124 ><DIV
125 CLASS="REFSECT1"
126 ><A
127 NAME="AEN1232"
128 ></A
129 ><H2
130 >Author</H2
131 ><P
132 >Norman Walsh, &lt;[email protected]&gt;</P
133 ></DIV
134 ><DIV
135 CLASS="REFSECT1"
136 ><A
137 NAME="AEN1235"
138 ></A
139 ><H2
140 >Source Code</H2
141 ><PRE
142 CLASS="PROGRAMLISTING"
143 >(define (component-list-child-number inputnd inputlist complist)
144 ;; Find child-number of a list of children within a component
145 (let loop ((nl (component-list-descendant-node-list
146 inputnd inputlist complist))
147 (num 1))
148 (if (node-list-empty? nl)
149 0
150 (if (node-list=? (node-list-first nl) inputnd)
151 num
152 (loop (node-list-rest nl) (+ num 1))))))</PRE
153 ></DIV
154 ><DIV
155 CLASS="NAVFOOTER"
156 ><HR
157 ALIGN="LEFT"
158 WIDTH="100%"><TABLE
159 SUMMARY="Footer navigation table"
160 WIDTH="100%"
161 BORDER="0"
162 CELLPADDING="0"
163 CELLSPACING="0"
164 ><TR
165 ><TD
166 WIDTH="33%"
167 ALIGN="left"
168 VALIGN="top"
169 ><A
170 HREF="component-descendant-list-node-list.html"
171 ACCESSKEY="P"
172 >Prev</A
173 ></TD
174 ><TD
175 WIDTH="34%"
176 ALIGN="center"
177 VALIGN="top"
178 ><A
179 HREF="index.html"
180 ACCESSKEY="H"
181 >Home</A
182 ></TD
183 ><TD
184 WIDTH="33%"
185 ALIGN="right"
186 VALIGN="top"
187 ><A
188 HREF="expt.html"
189 ACCESSKEY="N"
190 >Next</A
191 ></TD
192 ></TR
193 ><TR
194 ><TD
195 WIDTH="33%"
196 ALIGN="left"
197 VALIGN="top"
198 >component-list-descendant-node-list</TD
199 ><TD
200 WIDTH="34%"
201 ALIGN="center"
202 VALIGN="top"
203 ><A
204 HREF="r300.htm"
205 ACCESSKEY="U"
206 >Up</A
207 ></TD
208 ><TD
209 WIDTH="33%"
210 ALIGN="right"
211 VALIGN="top"
212 >expt</TD
213 ></TR
214 ></TABLE
215 ></DIV
216 ></BODY
217 ></HTML
218 >