0

I am working in SWI-Prolog.

We have been asked to do some 'pure logic' implementations, and to do so, some modules have to be added to the code (in order to control the execution of the code). Let us take one of them:

:- module(_,_,[]).

My code works fine without it, but when I add it (at the beginning of it), it fails with the message: Arguments are not sufficiently instantiated.

I have also tried adding :- module(_,_,[]). in an empty file and still fails with the same error; so it is not a problem of my code, but a problem of the module.

I have searched for the error, but I only find it related to a different problem: usually using some variable before declaring it, like in (Prolog - Arguments are not sufficiently instantiated).

false
  • 10,264
  • 13
  • 101
  • 209
Theo Deep
  • 666
  • 4
  • 15
  • 3
    The [`module/3`](https://eu.swi-prolog.org/pldoc/man?section=defmodule) directive DEFINES a module, i.e. declares that all the code in the file following `:- module(foo).` shall associated to an object called `foo`. What you are doing is trying to define a module but leaving the name blank, as the argument for the module name is the anonymous variable `_`. Evidently, this fails. – David Tonhofer May 14 '21 at 08:49
  • 2
    What this `module` directive does is that it defines a module (the file where you use this directive at the top). And if your example the module has a free variable in the first argument, the name, so this why it complain. What exactly are you trying to do? Declare a module or import an existing module? – TA_intern May 14 '21 at 08:50
  • 2
    I don't see what module declarations have to do with "pure logic" implementations (they have to do with grouping code, thus with software engineering, an orthogonal, and one might even say, contradictory concern to "pure logic"). There is some confusion here. – David Tonhofer May 14 '21 at 08:52
  • Hi thanks for answering!! I do not know why I should use those modules, I just see them here (first line) and it says they are necessary for pure LP: http://cliplab.org/logalg/slides/0-Examples/2examples_bfall.pl – Theo Deep May 14 '21 at 09:01
  • 1
    This is some placeholder for something. You are misunderstanding the comments. You should ask the person who provided you with this examples what they are supposed to mean and how you should use them. – TA_intern May 14 '21 at 10:30
  • Yes, I a realise there is something basic I do not understand. I will search for more info and complete the question. Thanks and sorry! – Theo Deep May 14 '21 at 10:34

0 Answers0