% $Id: Assoc.oz,v 1.2 2008/01/14 22:43:00 leavens Exp leavens $ declare fun {Assoc AL K} case AL of (K2#V|Rest) andthen K==K2 then V|{Assoc Rest K} [] _|KVs then {Assoc KVs K} else nil end end % another way (January 2008): declare fun {Assoc L Key} case L of nil then nil [] (K#V)|T then {Append if K == Key then [V] else nil end {Assoc T Key}} end end