assoc2 : ''a -> ('b * ''a) list -> ('b * ''a)option
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.
Never fails.
- assoc2 2 [(1,4),(3,2),(2,5),(2,6)]; > val it = SOME (3, 2) : (int * int) option