assoc2 : ''a -> ('b * ''a) list -> ('b * ''a)option
STRUCTURE
SYNOPSIS
Searches a list of pairs for a pair whose second component equals a specified value.
DESCRIPTION
An invocation assoc2 y [(x1,y1),...,(xn,yn)] returns SOME (xi,yi) for the first (xi,yi) in the list such that yi equals y. Otherwise, NONE is returned. The lookup is done on an eqtype, i.e., the SML implementation must be able to decide equality for the type of y.
FAILURE
Never fails.
EXAMPLE
- assoc2 2 [(1,4),(3,2),(2,5),(2,6)];
> val it = SOME (3, 2) : (int * int) option

SEEALSO
HOL  Trindemossen-1