]> Repositorios git - scryer-prolog.git/commitdiff
make current_predicate/1 more general, re: #66
authorMark Thom <[email protected]>
Thu, 28 Mar 2019 03:13:36 +0000 (21:13 -0600)
committerMark Thom <[email protected]>
Thu, 28 Mar 2019 03:13:36 +0000 (21:13 -0600)
src/prolog/lib/builtins.pl

index 52fd1a7ab94cd4e397d430c8c9d031d63bed3098..ff7a6a7102a7a58a230c6c3713e5fbf0ab099b26 100644 (file)
@@ -730,12 +730,10 @@ match_builtins(call, N) :-
     match_builtins(Name, Arity).
 
 current_predicate(Pred) :-
-    (  var(Pred) -> throw(error(type_error(predicate_indicator, Pred), current_predicate/1))
-    ;  Pred = _ / _ ->
-       (  '$get_current_predicate_list'(Ls),
-         '$iterate_predicate_list'(Ls, Pred)
-       )
-    ;  throw(error(type_error(predicate_indicator, Pred), current_predicate/1))
+    (  nonvar(Pred), Pred \= _ / _
+    -> throw(error(type_error(predicate_indicator,Pred), current_predicate/1))
+    ;  '$get_current_predicate_list'(Ls),
+       '$iterate_predicate_list'(Ls, Pred)
     ).
 
 bb_put(Key, Value) :- atom(Key), !, '$store_global_var'(Key, Value).