Author: workhouse123
-

What is the new age of AI?
The new AI age is both transformative and dialectical. It is migrating from closed to open systems, data and domains and shareable solutions and algorithms. The past low-level AI innovation has concentrated on creative settings, new tricks and hybridization, and knowledge transfer from other disciplines and systems
-

How has AI evolved in recent years?
The evolution of AI has seen remarkable advancements in natural language processing (NLP). Today’s AI can understand, interpret, and generate human language with unprecedented accuracy. This leap forward is evident in sophisticated chatbots, language translation services, and voice-activated assistants
-

Decomposing Atoms
Atom decomposing is just the reverse of constructing atoms. It helps us to get a sequence of characters, or a sequence ASCII codes from a given atom. To do this, we will again use atom_chars() and atom_codes() predicates but now, the first argument is an atom and the second argument is a variable. While atom_chars() decomposes atom to characters, atom_codes() decomposes them to…
-

Constructing Atoms
Atom constructing means forming individual atom(s). We get a single atom from a list of characters and multiple atoms a list of ASCII values. atom_chars() constructs atom from characters and atom_codes() construct atoms from ASCII values. In both the predicates, the first argument will be one variable, and the second argument will be a list.
-

Handling Input and Output
Till now, we have executed queries on the console. But many-a-times, it is necessary to some information from the user, process it and then display the result on the console. For such applications, we must know how to perform input-output operations in Prolog. The write() Predicate As the name suggests, the write() predicate takes the parameter as input, and…
-

Miscellaneous Programs
Program 1: Check whether the list has odd number of elements or the even number of elements. To implement this functionality, we will define predicates list_even_len(L) and list_odd_len(L) while considering the following points. Write the following rules in kb5.pl and execute the commands as shown below. Credit: Copyright (C) 1999-2021 Daniel Diaz Program 2: Find the maximum…
-

Shift Operation
Shift operation is used to shift one element of a list to the left rotationally. For example, given a list [a,b,c,d], then after shifting, it will be [b,c,d,a]. To implement shifting operation in Prolog, copy the following rule in kb5.pl and execute the instructions as given below. The clause list_shift(L1, L2) takes an input list…
-

Reverse Operation
The reverse operation arranges the items of a list in reverse order. For example, a list L = [a,b,c,d,e] when reversed will give output as [e,d,c,b,a]. To create a predicate, list_reverse(List, ReversedList), we must remember that, Add the instructions to implement list_rev predicate in kb5.pl and check the execution in console as shown in figure.
-

Append into List
While appending two lists, we add two lists or add one list as an element of the other list. If the element to be added is already present in the list, then the append function simply returns. Before writing instructions to implement list_append(L1, L2, L3) predicate, note that, If A is an element to be…
-

Delete from List
To delete an element X from a list L, one of the three cases may arise. We need to add the following instructions for the predicate list_delete in the kb5.pl and run the commands as shown in figure.