Re: Newbie, *really* basic question
From: Scott Bourbon (SCottB_at_hotmail.com)
Date: 07/05/04
- Next message: Bart Demoen: "Re: Newbie, *really* basic question"
- Previous message: Blackbird: "Re: Where are the real gurus?"
- Next in thread: Bart Demoen: "Re: Newbie, *really* basic question"
- Reply: Bart Demoen: "Re: Newbie, *really* basic question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 05 Jul 2004 07:11:03 +0200
Hi there,
I haven't tried with Ciao yet: after years of absence I'm back to
Prolog, finding a lot of interesting novelties.
Now: I suppose this is implementation dependent, but at least with
gprolog 1.2.16 you can get what you expected with
set_prolog_flag(unknown,fail).
| ?- likes(mary,john).
likes(mary,john).
uncaught exception: error(existence_error(procedure,likes/2),top_level/0)
| ?- set_prolog_flag(unknown,fail).
set_prolog_flag(unknown,fail).
yes
| ?- likes(mary,john).
likes(mary,john).
no
| ?-
It is to say you can get some control over the kind of Prolog reaction
to a query containing an unknown predicate.
Actually, the set_prolog_flag can act on various other aspects of the
interpreter, in gprolog;
Cheers,
Andrea Fedeli.
PS: I've just checked with SWI-Prolog: set_prolog_flag(unknown,fail). is
accepted, but it does not produce the same effect that in gnu prolog.
--
Bryan Glennon wrote:
> So, with time on my hands I decided to learn Prolog. Downloaded Caio
> Prolog, and got a copy of Programming in Prolog by Clocksin & Mellish. I
> am stuck on the first example. Here's the session output:
>
> Ciao-Prolog 1.9 #342: Sat Apr 24 20:46:05 2004
> ?- likes(john, mary).
> {ERROR: user:likes/2 - undefined predicate}
>
> no
> ?-
>
> I realize it's telling me that there is no predicate "likes" that takes
> 2 arguments, but nothing I have read indicated that I need to define
> that predicate somewhere.
>
> What am I missing?
>
> Thanks,
> Bryan
- Next message: Bart Demoen: "Re: Newbie, *really* basic question"
- Previous message: Blackbird: "Re: Where are the real gurus?"
- Next in thread: Bart Demoen: "Re: Newbie, *really* basic question"
- Reply: Bart Demoen: "Re: Newbie, *really* basic question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|