Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/smlnj-lib/Doc/ML-Doc/Util/bsearch.mldoc
ViewVC logotype

Annotation of /sml/trunk/src/smlnj-lib/Doc/ML-Doc/Util/bsearch.mldoc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 137 - (view) (download)

1 : monnier 137 <!-- bsearch.mldoc -->
2 :     <!-- Entities.sgml entry
3 :     <!ENTITY BSearchFn SDATA "bsearch-fn.sml">
4 :     -->
5 :    
6 :     <!DOCTYPE ML-DOC SYSTEM>
7 :    
8 :     <COPYRIGHT OWNER="Bell Labs, Lucent Technologies" YEAR=1998>
9 :     <VERSION VERID="1.0" YEAR=1998 MONTH=6 DAY=9>
10 :     <TITLE>The BSearchFn functor</TITLE>
11 :    
12 :     <INTERFACE>
13 :     <HEAD>The <CD/BSearchFn/ functor</HEAD>
14 :     <SEEALSO>
15 :     <FCTREF/ArrayQSortFn/
16 :     <STRREF TOPID/ArrayQSort/
17 :     </SEEALSO>
18 :    
19 :     <PP>
20 :     The <FCTREF NOLINK/BSearchFn/ functor implements binary searching
21 :     on sorted monomorphic arrays.
22 :    
23 :    
24 :     <FUNCTOR FCTID="BSearchFn"><ID>A<SIGREF DOCUMENT=SML-BASIS-DOC>MONO_ARRAY</SIGREF>
25 :     <SIGBODY FILE=BSearchFn>
26 :     <SPEC>
27 :     <SUBSTRUCT>A<SIGREF DOCUMENT=SML-BASIS-DOC>MONO_ARRAY</SIGREF></SUBSTRUCT>
28 :     <SPEC>
29 :     <VAL>bsearch<TY>(('a * A.elem) -> order) -> ('a * A.array) -> (int * A.elem) option
30 :     <COMMENT>
31 :     <PROTOTY>
32 :     bsearch <ARG/cmp/ (<ARG/a/, <ARG/arr/)
33 :     </PROTOTY>
34 :     performs a binary search, looking for <ARG/a/ in the
35 :     monomorphic array <ARG/arr/. It is
36 :     assumed that the array elements have some key, and have been
37 :     sorted non-decreasingly in terms of that key. The comparison function
38 :     <ARG/cmp/ is used to compare the elements of the array with the
39 :     value <ARG/a/.
40 :    
41 :     <PP>
42 :     If the search is successful, the element and its index are returned;
43 :     otherwise; <CONREF STRID="Option" DOCUMENT=SML-BASIS-DOC/NONE/ is returned.
44 :     </SIGBODY>
45 :     </FUNCTOR>
46 :    
47 :     </INTERFACE>

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0