uncaught exception

16 views
Skip to first unread message

Dili Shesh

unread,
Jan 28, 2016, 12:09:05 AM1/28/16
to SWI-Prolog
what_age(Other):-Other -5,format('~w Go to the college',[Grade])

what_age
(Other):-Grade is Other -5,format('~w Go to the college',[Grade]).

I am new to Prolog
 I got the orginal code from  a Online video when change the code as below I got this error 
uncaught exception: error(existence_error(procedure,(-)/2),what_age/1)

Anne Ogborn

unread,
Jan 28, 2016, 12:26:24 AM1/28/16
to Dili Shesh, SWI-Prolog
neither of these lines is reasonable Prolog.  In the first,

what_age(Other):-Other -5,format('~w Go to the college',[Grade])

you need a period at the end, and Grade is a 'singleton' - a variable that appears only once in a clause. Variables need to relate things to each other, so only using Grade once isn't useful.

The second line corrects this. Now Grade is Other -5

This line, however, lacks a period at the end.

I suspect you're typing these in at the top level. They go in a file.  See:











From: Dili Shesh <dili19...@gmail.com>
To: SWI-Prolog <swi-p...@googlegroups.com>
Sent: Wednesday, January 27, 2016 9:09 PM
Subject: [SWIPL] uncaught exception

--
You received this message because you are subscribed to the Google Groups "SWI-Prolog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+...@googlegroups.com.
Visit this group at https://groups.google.com/group/swi-prolog.
For more options, visit https://groups.google.com/d/optout.


Dili Shesh

unread,
Jan 28, 2016, 2:08:51 AM1/28/16
to SWI-Prolog, dili19...@gmail.com, anni...@yahoo.com
Then I change the code as 



what_age(Other):-Other -5,format('~w Go to the college',[Other]).
But still I am  getting the error

uncaught exception: error(existence_error(procedure,(-)/2),what_age/1)
Reply all
Reply to author
Forward
0 new messages