title: Prolog Procedure Does not Exist
body: <p>I've copied the code from a text book for a simple UI in Prolog, as below, or on this URL: <a href="https://swish.swi-prolog.org/p/QgEReeXy.pl" rel="nofollow noreferrer">https://swish.swi-prolog.org/p/QgEReeXy.pl</a></p>
  
  <pre><code>/* Weather knowledge base*/
  weather(good):-
      temp(high),
      humidity(dry),
      sky(sunny).
  
  weather(bad):-
      (humidity(wet);
      temp(low);
      sky(cloudy)).
  
  /* interface */
  go:-
      write('Is the temperature high or low?'),
      read(Temp), nl,
      write('Is the sky sunny or cloudy?'),
      read(Sky), nl,
      write('Is the humidity dry or wet?'),
      read(Humidity), nl,
      assert(temp(Temp)),
      assert(sky(Sky)),
      assert(humidity(Humidity)),
      weather(Weather),
      write('The weather is '), write(Weather),
      retractall(temp(_)),
      retractall(sky(_)),
      retractall(humidity(_)).
  </code></pre>
  
  <p>When I run <code>go.</code> I get </p>
  
  <pre><code>procedure `temp(A)' does not exist
  Reachable from:
        weather(A)
        go
  </code></pre>
  
  <p>Is this due to a small typo, or is there a bigger problem with the code please?</p>