# ChatGPT prompts - Programming - Non-coding

### Translating (Natural Language)

Prompt

Generate Prolog unification questions for a test and supply an answer sheet.

ChatGPT Completion

Prolog Unification Test:

1. What is Unification in Prolog?
2. Give an example of Unification in Prolog.
3. What is the difference between Prolog variables and atoms?
4. What is the purpose of the ‘=’ operator in Prolog?
5. What is the result of the following Prolog query?
X = Y, Y = [1,2,3].
1. What is the result of the following Prolog query?
X = [1, Y], Y = [2, 3].
1. What is the result of the following Prolog query?
X = [1, Y, Z], Y = 2, Z = [3].

1. Unification in Prolog is a process that determines if two terms can be made equivalent.
2. Example: X = Y, Y = [1,2,3]. X = [1,2,3].
3. Prolog variables are placeholders for values, while atoms are named constants.
4. The ‘=’ operator is used to unify two terms in Prolog.
5. X = [1,2,3].
6. X = [1, [2,3]].
7. X = [1,2,[3]].

Prompt

ChatGPT Completion

Test d’unification Prolog :

1. Qu’est-ce que l’unification en Prolog ?
2. Donnez un exemple d’unification en Prolog.
3. Quelle est la différence entre les variables Prolog et les atomes ?
4. Quel est le but de l’opérateur ‘=’ en Prolog ?
5. Quel est le résultat de la requête Prolog suivante ?
X = Y, Y = [1,2,3].
1. Quel est le résultat de la requête Prolog suivante ?
X = [1, Y], Y = [2, 3].
1. Quel est le résultat de la requête Prolog suivante ?
X = [1, Y, Z], Y = 2, Z = [3].

Feuille de réponses:

1. L’unification en Prolog est un processus qui détermine si deux termes peuvent être rendus équivalents.
2. Exemple : X = Y, Y = [1,2,3]. X = [1,2,3].
3. Les variables Prolog sont des placeholders pour les valeurs, tandis que les atomes sont des constantes nommées.
4. L’opérateur ‘=’ est utilisé pour unifier deux termes en Prolog.
5. X = [1,2,3].
6. X = [1, [2,3]].
7. X = [1,2,[3]].

Prompt

For those new to Prolog many of the answers below are lacking/flawed in some way. One could spend a good day or two nothing the problems as well as the good points. So be skeptical of each and every answer.

ChatGPT Completion

“For those new to Prolog, be aware that many of the answers below may contain flaws or inaccuracies. It is advisable to critically evaluate each answer and spend time noting both the strengths and weaknesses. Trust but verify.”

### Use as thesaurus

Prompt

Synonyms for abstraction related to programming

ChatGPT Completion

Here are some synonyms for “abstraction” related to programming:

• Abstraction layer
• Conceptualization
• Generalization
• Simplification
• Decoupling
• Isolation
• Indirection
• Virtualization
• Encapsulation
• Wrapper
• Representation

### Use as dictionary

Prompt

Define indirection related to programming.

ChatGPT Completion

In programming, “indirection” refers to the practice of accessing data or functions indirectly, rather than directly. It’s a technique that allows you to decouple a particular component of your code from its implementation details, so that you can change the underlying implementation without affecting the rest of the code.

Indirection is achieved through various means, such as pointers, references, or function pointers in C/C++, or through abstractions like interfaces or objects in object-oriented languages. The goal of indirection is to promote modularity, flexibility, and maintainability of code by reducing coupling between different parts of the system.

### LaTeX

Prompt

Demonstrate using LaTeX to create a pdf document.

ChatGPT Completion

Certainly! Here is an example LaTeX document that you can use to create a PDF:

\documentclass{article}

\begin{document}

Hello, world! This is a LaTeX document.

\end{document}

You can save this code as a text file with the extension “.tex”. Then, you can compile it into a PDF using a LaTeX compiler. There are many different LaTeX compilers available, but one popular choice is TeXworks.

Once you have a LaTeX compiler installed, you can open the “.tex” file in the compiler and click the “compile” button to generate a PDF file. The resulting PDF should contain the text “Hello, world! This is a LaTeX document.”

This is just a simple example, but there are many more advanced features you can use in LaTeX to create professional-looking documents with tables, figures, equations, and more.

### Identifying Files

Prompt

/mingw64/bin/librocksdb.dll
/mingw64/include/rocksdb/rocksdb_namespace.h
/mingw64/lib/cmake/rocksdb
/mingw64/lib/librocksdb.a
/mingw64/lib/librocksdb.dll.a
/mingw64/lib/pkgconfig/rocksdb.pc
/var/lib/pacman/local/mingw-w64-x86_64-rocksdb-7.9.2-1

ChatGPT Completion

These appear to be files related to the RocksDB library, which is an embedded database designed for high performance and low latency. It is often used as a storage engine for other database systems or as a standalone key-value store.

The files you listed are typically found in the installation directory of RocksDB on a system that uses the MinGW-w64 toolchain. Here is a brief overview of what each of these files/directories is for:

• /mingw64/bin/librocksdb.dll’: Dynamic-link library (DLL) containing the compiled code for RocksDB.
• /mingw64/include/rocksdb/rocksdb_namespace.h’: Header file defining the namespace and other common symbols used in RocksDB.
• /mingw64/lib/cmake/rocksdb’: CMake configuration files for building projects that use RocksDB.
• /mingw64/lib/librocksdb.a’: Static library containing the compiled code for RocksDB.
• /mingw64/lib/librocksdb.dll.a’: Import library for linking against the RocksDB DLL.
• /var/lib/pacman/local/mingw-w64-x86_64-rocksdb-7.9.2-1’: Directory containing information about the installed package version for the Pacman package manager.

It’s worth noting that the specific paths and filenames may vary depending on the operating system and installation method used.

### Use with MathJax

ChatGPT can generate MathJax.

With Chrome browser extension TeX All the Things installed, the mathematical expressions can be converted to math.

Prompt

Display the following equation in LaTeX

Schrödinger equation

ChatGPT Completion

Right click any math expression created using MathJax should display a context menu.

Also of note is that OpenAI has created ChatML so it will be interesting to see what else can be done besides just text.

### Listing Exectuable Files for LInux

Prompt

Ubuntu, list executable files in a directory.

ChatGPT Completion

To list executable files in a directory in Ubuntu, you can use the ls command with the -l (long listing) and -F (classify) options, and then filter the output to show only the files that have the executable permission.

Here is the command to do this:

ls -lF | grep "^-..x"

Let’s break down this command:

• ls -lF lists the files in long listing format and adds a slash (/) to the end of directory names and an asterisk (*) to the end of executable files.
• grep "^-..x" filters the output to show only files that have the executable permission. The regular expression ^-..x matches lines that start with a hyphen (-) followed by any two characters (…) and an x at the end, which indicates an executable file.

This command will list all the executable files in the current directory. If you want to list the executable files in a specific directory, replace the . (current directory) with the path to the directory you want to list.