From: Mark Thom Date: Thu, 28 Mar 2019 03:13:36 +0000 (-0600) Subject: make current_predicate/1 more general, re: #66 X-Git-Tag: v0.8.110~149 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=e7bc01369a5d59856d31f96d5f35f743d2e9c8c0;p=scryer-prolog.git make current_predicate/1 more general, re: #66 --- diff --git a/src/prolog/lib/builtins.pl b/src/prolog/lib/builtins.pl index 52fd1a7a..ff7a6a71 100644 --- a/src/prolog/lib/builtins.pl +++ b/src/prolog/lib/builtins.pl @@ -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).