1\DOC assoc1
2
3\TYPE {assoc1 : ''a -> (''a * 'b) list -> (''a * 'b)option}
4
5\SYNOPSIS
6Searches a list of pairs for a pair whose first component equals a
7specified value.
8
9\KEYWORDS
10list.
11
12\DESCRIBE
13{assoc1 x [(x1,y1),...,(xn,yn)]} returns {SOME (xi,yi)} for the first
14pair {(xi,yi)} in the list such that {xi} equals {x}. Otherwise, {NONE}
15is returned. The lookup is done on an eqtype, i.e., the SML
16implementation must be able to decide equality for the type of {x}.
17
18\FAILURE
19Never fails.
20
21\EXAMPLE
22{
23- assoc1 2 [(1,4),(3,2),(2,5),(2,6)];
24> val it = SOME (2, 5) : (int * int)option
25}
26
27
28\SEEALSO
29Lib.assoc, Lib.assoc2, Lib.rev_assoc, Lib.mem, Lib.tryfind, Lib.exists,
30Lib.all.
31
32\ENDDOC
33