diff --git a/src/canary/metta_space.pl b/src/canary/metta_space.pl index 73b66412c21..a8a02d48c9a 100755 --- a/src/canary/metta_space.pl +++ b/src/canary/metta_space.pl @@ -668,22 +668,23 @@ */ search_for1(X):- forall((metta_atom(_Where,What),contains_var(X,What)), - write_src_nl(What)). + (nl,write_src_nl(What))). search_for2(X):- - forall((metta_src(_Where,What),contains_var(X,What)), - write_src_woi_nl(What)). + forall((metta_file_src(_Where,What),contains_var(X,What)), + (nl,write_src_nl(What))). -metta_src(Where,What):- +metta_file_src(Where,What):- loaded_into_kb(Where,File), metta_file_buffer(_,What,Vars,File,_Loc), ignore(maplist(name_the_var,Vars)). -name_the_var(N=V):- ignore((atom_concat('_',NV,N),V='$VAR'(NV))). guess_metta_vars(What):- ignore(once((metta_file_buffer(_,What0,Vars,_File,_Loc), - alpha_unif(What,What0), + alpha_unify(What,What0), maplist(name_the_var,Vars)))). +name_the_var(N=V):- ignore((atom_concat('_',NV,N),V='$VAR'(NV))). + +alpha_unify(What,What0):- What=@=What0,(nonvar(What)->What=What0;What==What0). -alpha_unif(What,What0):- What=@=What0,What=What0. diff --git a/src/canary_docme/metta_server.pl b/src/canary_docme/metta_server.pl index bfa1233315b..9dc100ae641 100644 --- a/src/canary_docme/metta_server.pl +++ b/src/canary_docme/metta_server.pl @@ -55,7 +55,7 @@ :- use_module(library(thread)). % Provides predicates for multi-threading % Predicate to execute a goal and determine if it was deterministic -%! call_wdet(+Goal, -WasDet) is semidet. +%! call_wdet(+Goal, -WasDet) is nondet. % % Calls the given Goal and checks if it was deterministic. % @@ -125,12 +125,14 @@ % Start the VSpace service with the generated Alias, MSpace, and Port start_vspace_service(Alias,MSpace,Port). -% Skip starting the service if it is already running -%! start_vspace_service(+Alias, +_Space, +_Port) is det. +%! start_vspace_service(+Alias, +Space, +Port) is det. % % Starts the VSpace service only if it is not already running under the given Alias. % % @arg Alias is the alias to check for an existing service. + + +% Skip starting the service if it is already running start_vspace_service(Alias,_Space,_Port):- % If the service is already running under Alias, do nothing service_running(Alias), @@ -219,6 +221,8 @@ setup_call_cleanup( % Open the socket as a stream tcp_open_socket(RemoteFd, Stream), + % Generate a unique symbol for the thread alias + nb_setval(self_space,MSpace), % Handle the connection by processing incoming goals ignore(handle_vspace_peer(Stream)), % Ensure the stream is closed when done