aaron.johnson.35325074 0 Newbie Poster

I need to create a function in Standard ML called lookup(k, table) that returns NONE if k is not a key in the lookup table and returns (SOME (k,v)) if (k,v) is in the table. For example lookup(3, [(1,4),(14,5),(7,3),(22,6]) is NONE and lookup (1,[(1,4),(14,5),(7,3,(22,6)]) is (SOME (1,4)).

And i want to use this find function:

    fun find pred [] = NONE
      | find pred (x::rest) = if pred x then SOME x else find pred rest;

This is what i have so far:

    fun lookup(k,table) = NONE
     | lookup(k, find(k,table)) =
        if k = SOME then SOME else NONE;

Please help me, I have been pulling out hair because of this ML problem.