When I entuer in gnu prolog: man (adam). I get the following error: uncaught exception: error(syntax_error('user_input:1 (char:5) . or operator expected after expression'),read_term/3) That would be entering a fact. What am I doing wrong ?
> When I entuer in gnu prolog:
> man (adam).
> I get the following error:
> uncaught exception: error(syntax_error('user_input:1 (char:5) . or operator
> expected after expression'),read_term/3)
> That would be entering a fact.
> What am I doing wrong ?
You are putting a space between 'man' and the '('.
On 23 Wrz, 14:57, "Haris Bogdanovich" <fbogdano...@xnet.hr> wrote:
> > You are putting a space between 'man' and the '('. > Now I wrote:
> man(adam). > without a space and I got: > uncaught exception: error(existence_error(procedure,man/1),top_level/0) > What's wrong now ?
You try to query fact man/0, but you didn't have any facts in database, so you get existence_error. So you can either declare fact: ?- assertz(man(adam)). or consult Prolog source file containing your facts, man(adam). or man(X).
> On 23 Wrz, 14:57, "Haris Bogdanovich" <fbogdano...@xnet.hr> wrote:
> > > You are putting a space between 'man' and the '('. > > Now I wrote:
> > man(adam). > > without a space and I got: > > uncaught exception: error(existence_error(procedure,man/1),top_level/0) > > What's wrong now ?
> You try to query fact man/0, but you didn't have any facts in > database, so you get existence_error. > So you can either declare fact: ?- assertz(man(adam)). > or consult Prolog source file containing your facts, man(adam). or > man(X).
> Regards, > Tomasz Budzeń
This is something of a quirk/feature of gprolog. Many implementations will return "no" or "false" in such a case.