In ISO-Prolog and conforming systems, the system signals such an error as an existence_error(procedure,fruit/1)
. To be more precise, there is a Prolog flag unknown
which should be set to error
to get that behavior. Most systems take this as (the very reasonable) default. But to be sure, simply issue the goal set_prolog_flag(unknown,error)
.
Note that the error says that fruit/1
is expected to exist, but does not make any further assumptions as you do.
You are suggesting that the error is a missing argument. That might very well be the error. Equally well, it could be a typo meaning fuit/1
which is French (he flees) or Latin (he was). Or maybe you simply forgot to nest the term appropriately. Who knows. There are many good theories what the actual error might be, so your suggestion should be a bit more cautious.
In many systems there are similar suggestions, they are often connected to the toplevel loops that interprets uncaught errors.
You can catch such errors yourself like so:
?- catch(Goal, error(existence_error(procedure,Inex),_), Action_on_error).