How to resolve the algorithm Program name step by step in the Prolog programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Program name step by step in the Prolog programming language
Table of Contents
Problem Statement
The task is to programmatically obtain the name used to invoke the program. (For example determine whether the user ran "python hello.py", or "python hellocaller.py", a program importing the code from "hello.py".) Sometimes a multiline shebang is necessary in order to provide the script name to a language's internal ARGV. See also Command-line arguments Examples from GitHub.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Program name step by step in the Prolog programming language
Source code in the prolog programming language
% SWI-Prolog version 8.0.0 for i686-linux.
% This will find itself, and return the knowledge base it is in.
file_name(F) :- true
, M = user % M is the module .
, P = file_name(_) % P is the predicate .
, source_file(M:P, F) % F is the file .
, \+ predicate_property(M:P, imported_from(_))
.
:- multifile(this_is_one_of_my_files). this_is_one_of_my_files.
You may also check:How to resolve the algorithm Loops/Downward for step by step in the Frink programming language
You may also check:How to resolve the algorithm Cumulative standard deviation step by step in the Liberty BASIC programming language
You may also check:How to resolve the algorithm Atomic updates step by step in the PureBasic programming language
You may also check:How to resolve the algorithm Ackermann function step by step in the CoffeeScript programming language
You may also check:How to resolve the algorithm GUI component interaction step by step in the Smalltalk programming language