title: Prolog Analogy IQ Test Unexpected token exception
body: <p>I am trying to develop a program that will be able to solve an analogy IQ test. As you can see below I've written the figures and relations as facts and I've also made an analogy Predicate that should return one figure number when given three other figure numbers. The first two figures are connected through a relation and the 3rd and 4th are also connected through the same relation.</p>
  <p>For example, analogy should work like this: analogy(1,5,3,X). X=7.</p>
  <pre><code>figure 1 -&gt; middle(triangle, square)
  figure 5 -&gt; middle(square, triangle)
  relation between 1 &amp; 5 -&gt; inverse
  figure 3 -&gt; middle(square, circle)
  figure 7 -&gt; middle(circle, square)
  relation between 3 &amp; 7 -&gt; inverse
  </code></pre>
  <p>when I compile the code I get the following exception: file test lab 1.ecl, line 105: syntax error: unexpected token
  |   figure(S1, _(Sh1,Sh2)),
  |                   ^ here</p>
  <p>What do I do wrong?</p>
  <pre><code>figure(1, middle(triangle, square)).
  figure(2, middle(circle, triangle)).
  figure(3, middle(square, circle)).
  figure(4, middle(square, square)).
  figure(5, middle(square, triangle)).
  figure(6, middle(triangle, circle)).
  figure(7, middle(circle, square)).
  figure(8, middle(triangle, triangle)).
  figure(9, samepattern(lowerleft, circle)).
  figure(10, samepattern(upperleft, circle)).
  figure(11, samepattern(lowerright, circle)).
  figure(12, samepattern(upperright, circle)).
  figure(13, samepattern(upperleft, square)).
  figure(14, samepattern(lowerleft, square)).
  figure(15, samepattern(upperright, square)).
  figure(16, samepattern(lowerright, square)).
  
  relation(middle(S1,S2), middle(S2,S1), inverse).
  relation(samepattern(S1,S2), samepattern(S1,S3), spinverse).
  
  
  analogy(S1,S2,S3,S4):-
      figure(S1, _(Sh1,Sh2)),
      figure(S2, _(Sh3,Sh4)),
      relation(_(Sh1,Sh2),_(Sh3,Sh4),R),
      figure(S3, _(Sh5,Sh6)),
      figure(S4, _(Sh7,Sh8)),
      relation(_(Sh5,Sh6),_(Sh7,Sh8),R).
  </code></pre>