title: I have a mutual recursion problem in f-sharp
body: <p>I have the following types in F#:</p>
  <pre><code>type Name = string;;
  type Sex = 
      | M // male
      | F // female
  type YearOfBirth = int;;
  type FamilyTree = P of Name * Sex * YearOfBirth * Children
  and Children = FamilyTree list;;
  
  //here is an example:
  let f1 = P(&quot;Larry&quot;,M,1920,[P(&quot;May&quot;,F,1945,[P(&quot;Fred&quot;,M,1970,[])]);P(&quot;Joe&quot;,M,1950,[P(&quot;Adam&quot;,M,1970,[])]);P(&quot;Paul&quot;,M,1955,[])])
  </code></pre>
  <p>My task is to create a function: find: Name -&gt; FamilyTree -&gt; returns (found name, sex, year, [List of the names of all their children]</p>
  <p>I know it has something to do with mutual recursion but I am not sure how to apply it.
  This is what I wrote so far:</p>
  <pre><code>let fstn (f:FamilyTree) =
      match f with
      |P(n,s,y,c) -&gt; n
  
  let rec find n t = function
      |P(n1,s1,y1,cs) -&gt; if n1=n then (n1,s1,y1,List.map (fun x -&gt; fstn x) cs) 
                             else findC n cs
  and findC n clist =
      match clist with
      |[] -&gt; []
      |c::cs -&gt; if n = fstn c then find n c 
                              else findC n cs
  </code></pre>
  <p>When I run</p>
  <pre><code>find &quot;May&quot; f1;;
  </code></pre>
  <p>I get:</p>
  <pre><code>error FS0001: This expression was expected to have type
      'Name * Sex * YearOfBirth * Name list'
  but here has type
      ''a list'
  </code></pre>
  <p>Does anyone know what I am doing wrong? I know there is a problem with types but I am not sure how to fix it. I could use all the help I could get, thank you very much!</p>