title: prolog passing a function as a variable, how to add arguments?
body: <p>I have this arbitrary function that I need to call many times with different variables.
  btw, this is SWI-Prolog</p>
  
  <pre><code>perform(V1,V2,V3,Function,Result):-
      % 
      % do little stuf.
      %
      Function(Arg1,Arg2,Result).
  </code></pre>
  
  <p>This gives a syntax error.</p>
  
  <p>But passing a function as a variable without adding arguments works fine as in the following code:</p>
  
  <pre><code>perform(Function):-
      Function.
  
  sayHello:-
      write('hello').
  
  :-perform(sayHello).
  </code></pre>
  
  <p>So how to add arguments to a variable function?</p>