need to intercept existence error for facts in Quintus 
Author Message
 need to intercept existence error for facts in Quintus

    Curtis> Hi.  I am using Quintus Prolog.  I have the following type
    Curtis> of code Fact =.. [aFact, aParm, aParm2], Fact,

    Curtis> The problem I have is that if "aFact(aParm, aParm2)" does
    Curtis> not exist I get the following error message: ! Existence
    Curtis> error in somePredicate/5 ! procedure aFact/2 does not
    Curtis> exist

    Curtis> Is there some way to trap this at run time?  I believe
    Curtis> that clause/2 would help but I want to avoid the extra
    Curtis> overhead of calling clause (the Quintus manual even
    Curtis> suggests this).

I implemented an autoloader for Prolog that worked like this.  The
unknown predicate gets loaded on first-call if it has an entry in the table.
This has been implemented in several version of Quintus Prolog.

:- multifile unknown_predicate_handler/3.

unknown_predicate_handler(Goal, Module, Goal):-
        functor(Goal, Functor, Arity),
        autoload_predicate(Functor, Arity, File),
        !,
        notify(notice, ['% autoloading file/s: ', File]),
        Module:load_files(File).

% Define one clause for each entry point of an autoloaded file,
%
% autoload_predicate(Functor, Arity, FileName)
%
% where FileName is the file that contains defs for Functor/Arity.

--
John Dowding



Sun, 05 Jul 1998 03:00:00 GMT  
 need to intercept existence error for facts in Quintus
Hi.  I am using Quintus Prolog.  I have the following type of code

        Fact =.. [aFact, aParm, aParm2],
        Fact,

The problem I have is that if "aFact(aParm, aParm2)" does not exist I
get the following error message:
        ! Existence error in somePredicate/5
        ! procedure aFact/2 does not exist

Is there some way to trap this at run time?  I believe that clause/2
would help but I want to avoid the extra overhead of calling clause
(the Quintus manual even suggests this).

Any suggestions.

Thanks for your time.

Curtis
--
-------------------------------------------------------------------------------
| Curtis Hrischuk (PhD Cand)  | Boundaries of Science:                        |

| Carleton University         | 2) Why am I here?                             |
| Ottawa, On. ,Canada, K1S-5B6| 3) What happens when I leave?                 |
| Ph  (613) 788-2600 x1762    | "The proof is almost identical to the previous|
| FAX (613) 788-5727          | proof and hence omitted here."(actual quote)  |



Sun, 05 Jul 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Checking File Existence in Quintus PROLOG

2. Problem in adding in facts dynamicly in Quintus Prolog Release 3.4

3. Intercepting errors

4. intercept errors

5. getting started SICSTUS (existence error)

6. X interface in Quintus prolog or C(C++) interface in Quintus prolog

7. Need help with streams under Quintus

8. tel# needed for Quintus

9. Quintus' Prolog++ -- Some help needed

10. Dataset existence

11. Test for existence of web file (URL)

12. How to check a given class for existence?

 

 
Powered by phpBB® Forum Software