title: Higher order function on lists Ocaml
body: <p>I created a function <code>p</code> that checks if the square of a given value is lower than <code>30</code>.
  Then this function is called in an other function (as argument) to return the first value inside a list with its square less then 30 ( if p is true, basically I have to check if the function <code>p</code> is <code>true</code> or <code>false</code> ).</p>
  <p>This is the code :</p>
  <pre><code>let p numb = 
  let return = (numb * numb) &lt; 30 in return
  
  let find p listT =
    let rec support p listT =
      match listT with
      | []-&gt; raise (Failure &quot;No element in list for p&quot;)
      | hd :: tl -&gt; if p hd then hd
      else support p tl in
      let ret = support (p listT) in ret
  
  let () =
    let a = [5;6;7] in
    let b = find p a in print_int b
  </code></pre>
  <p>But it said on the last line :</p>
  <pre><code>Error: This expression (p) has type int -&gt; bool
     but an expression was expected of type int -&gt; 'a -&gt; bool
     Type bool is not compatible with type 'a -&gt; bool 
  </code></pre>
  <p>However, I don't think I'm using higher order functions in the right way, I think it should be more automatic I guess, or not?</p>