title: SML error: unresolved flex record
body: <p>I've just started learning SML and I'm trying to create a function that given an environment and a variable name, returns the int value associated with the variable name. For example if the environment e3 is [("y",100),("x",200)], then calling lookup e3 "y" should return 100. This is what I have so far.</p>
  
  <pre><code>fun lookup nil name = raise NameNotBound name
    | lookup Env name = 
      let
         val e = tl Env;
      in
         if #1(hd Env) = name
         then #2(hd Env)
         else lookup e name
      end;
  </code></pre>
  
  <p>however when I run this I get the error message "Error: unresolved flex record (need to know the names of ALL the fields in this context)
  type : {1:string, 2:'Y; 'Z}</p>
  
  <p>I'm honestly not really sure what this error means, I've tried looking it up on the smlnj website and on here but couldn't quite figure it out. Any advice on this would be appreciated.</p>