Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!hookup!olivea!news.hal.COM!decwrl!amd!netcomsv!netcomsv!ix.netcom.com!netcom.com!ludemann
From: ludemann@netcom.com (Peter Ludemann)
Subject: Re: My prolog have no "define/2"!
Message-ID: <ludemannCzyq8L.5JD@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
References: <3bak1b$iaf@nic-nac.csu.net>
Date: Mon, 28 Nov 1994 05:36:21 GMT
Lines: 33

In article <3bak1b$iaf@nic-nac.csu.net>,
Yuan-chi (Bill) Chiu <hbcsc112@huey.csun.edu> wrote:
>   I'm using Quantus Prolog.  From the list of build-in predicates in
>the manual, there is no predicate define/2.
>
>   define/2 basically tells the prolog that there is a new predicate
>with arity of #.  For example, define(apple, 3) means new there is a
>predicate with functor "apple" and arity of 3.  (i.e. apple(a, b, c) ).
>
> ...

I'm not quite sure what you're trying to do.  There's no need to
"define" a predicate except by its clauses.  If you're importing it
from another file, you use something like "consult(...)",
"use_module(...)", "load_file(...)", etc.

If you're dynamicly asserting a predicate, you can simply put this
in your file:
	:- dynamic apple/3.

If you do this, and you haven't done any assert(apple(...,...,..)),
then any call to apple/3 will simply fail.

Alternatively, in your code, you could execute
	retractall(apple(_,_,_))
before the first time you use apple/3.

If apple/3 is "static", then you can avoid the "predicate not defined"
error message by defining apple/3 this way:
	apple(_,_,_) :- fail.

-- 
Peter Ludemann                      ludemann@netcom.com
