Program name: Difference between revisions

Content added Content deleted
Line 1,310: Line 1,310:


=={{header|Prolog}}==
=={{header|Prolog}}==
<lang Prolog>
<lang Prolog>% SWI-Prolog version 8.0.0 for i686-linux.
% This will find itself, and return the knowledge base it is in.
% SWI-Prolog version 8.0.0 for i686-linux
% This will find itself, and return the file it is in.
file_name(F) :- true
file_name(F) :- true
, M = user % M is the module .
, M = user % M is the module .
, P = file_name(_) % P is the predicate .
, P = file_name(_) % P is the predicate .
, source_file(M:P, F) % F is the filename .
, source_file(M:P, F) % F is the file .
, \+ predicate_property(M:P, imported_from(_))
, \+ predicate_property(M:P, imported_from(_))
.
.</lang>

</lang>
Alternatively, you may prefer a list of all your knowledge bases; adding the following code to each of your knowledge bases will allow you to query <code>findall(F,source_file(this_is_one_of_my_files,F),L).</code>.
<lang Prolog>:- multifile(this_is_one_of_my_files). this_is_one_of_my_files.</lang>


=={{header|PureBasic}}==
=={{header|PureBasic}}==