users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Users-prolog Digest, Vol 71, Issue 5


From: Duncan Patton a Campbell
Subject: Re: Users-prolog Digest, Vol 71, Issue 5
Date: Sat, 7 Mar 2009 18:35:07 -0700


> > GNU Prolog 1.3.1
> > By Daniel Diaz
> > Copyright (C) 1999-2009 Daniel Diaz
> > | ?- even(X).
> > uncaught exception: error(existence_error(procedure,even/1),top_level/0)
> 
> I'm a bit rusty, and only just installed gprolog myself, and am not
> familiar with its messages.  But it looks to me like there is no
> predicate 'even/1' defined -- "existence_error(procedure,even/1).

"existence_error" means there is no such predicate available to
the interpreter: it is neither a built-in nor user construct.

Amongst other places, the Gprolog docs are at

http://www.gprolog.org/manual/html_node/index.html

and you can find the builtin predicates in 

http://www.gprolog.org/manual/html_node/gprolog-idx.html

To create a user defined predicate, even/1, you would 
open a text file, called test2.pl with notepad (or some
other text editor) and enter the line:

even(X):- U is X mod 2, !,U == 0.

save the file and at the interpreter prompt enter

| ?- [test2]. 

and then

| ?- even(12).


So now U have defined a user predicate called even
that tests for "evenness" with the mod function.


Dhu

> 
> Try something like reverse([1,2,3],X).  If that doesn't work, you have
> an installation error.
> 
> >
> > not sure if the installation was wrong, but got not errors or I'm missing
> > something very simple.
> > also is there a good FAQ's page for this interpreter.
> 
> Google "gprolog tutorial"  I get lots of hits.  I think you need a tutorial
> rather than a FAQ.  Work through some of these.
> 
> >
> > many thanks
> >
> > James.
> >
> > ps. sorry if this is a silly posting but didn't know what else to try :S 
> 
> Good luck.   This looks like a low traffic list, so I thought I'd go ahead 
> and answer
> instead of waiting for a expert.
> 
> John Velman
> 
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> Users-prolog mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/users-prolog
> 
> 
> End of Users-prolog Digest, Vol 71, Issue 5
> *******************************************
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]