fix nth_instance: fix bugs and actually add two versions (obs from Theofrastos Mantadelis)
This commit is contained in:
20
pl/utils.yap
20
pl/utils.yap
@@ -472,12 +472,20 @@ callable(V) :- var(V), !, fail.
|
||||
callable(V) :- atom(V), !.
|
||||
callable(V) :- functor(V,_,Ar), Ar > 0.
|
||||
|
||||
nth_instance(X,Y,Z) :-
|
||||
nonvar(X), var(Y), var(Z), !,
|
||||
recorded(X,_,Z),
|
||||
'$nth_instance'(_,Y,Z).
|
||||
nth_instance(X,Y,Z) :-
|
||||
'$nth_instance'(X,Y,Z).
|
||||
nth_instance(Key,Index,Ref) :-
|
||||
nonvar(Key), var(Index), var(Ref), !,
|
||||
recorded(Key,_,Ref),
|
||||
'$nth_instance'(_,Index,Ref).
|
||||
nth_instance(Key,Index,Ref) :-
|
||||
'$nth_instance'(Key,Index,Ref).
|
||||
|
||||
nth_instance(Key,Index,T,Ref) :-
|
||||
nonvar(Key), var(Index), var(Ref), !,
|
||||
recorded(Key,T,Ref),
|
||||
'$nth_instance'(_,Index,Ref).
|
||||
nth_instance(Key,Index,T,Ref) :-
|
||||
'$nth_instance'(Key,Index,Ref),
|
||||
instance(Ref,T).
|
||||
|
||||
nb_current(GlobalVariable, Val) :-
|
||||
var(GlobalVariable), !,
|
||||
|
Reference in New Issue
Block a user