term_string('A', "'A'")

FYI for those wondering how to track down source code when it passes from Prolog to C.


Normally to see the code behind a documented predicate just go to the SWI-Prolog documentation page and click on image

E.g.

For append/2, image links to append/2 source code

Note: image is at the right of
image


However for atom_length/2 it shows.

image

So the documentation will not help at this point the source code has to be searched.

The source code is on GitHub with two repositories for SWI-Prolog

Typically ones SWI-Prolog version is in sync with the latest SWI-Prolog development release so that repository will be used.

Browse to the GitHub repository for SWI-Prolog development.
(https://github.com/SWI-Prolog/swipl-devel)

In the upper left search box
image

enter the search word: atom_length and press enter.

On the left at the bottom click Advanced search

For Written in this language select: C

Click Search

This shows the C implementation of atom_length/2 is in the src directory and pl-prims.c file.



A more efficient way I have found to search for such is to use Notepad++ to search a directory of local copies of GitHub repositories. A bit more details are in this reply.