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 ASCII values.

images

Credit: Copyright (C) 1999-2021 Daniel Diaz

images

The consult() Predicate

The consult() predicate is used to merge the predicates from different files. It accepts filename as an argument for consultation. To understand this concept, make two .pl files and execute the following instructions in console.

images

images

images

Now from this output we can understand that this is not as simple as it seems. If two files have completely different clauses, then it will work fine. But if there are same predicates, then while we try to consult the file, it will check the predicates from the second file, when it finds some match, it simply deletes all of the entry of the same predicates from the local database, then load them again from the second file.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *