atom_number/2: Type error
Steve Moyle <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
I am struggling to understand this error message:
ERROR: atom_number/2: Type error: `atom' expected, found `1'
I am using Nico's prosqlite which seems to bring back items in single quotes.
I have a table that comes from directly mapping sqlite3 'OTUTable'/6.
So to change some of the fields I am using atom_number/2 to do some type conversion before any other operations.
atom_number/2 seems to behave as I expect on the command line (e.g.):
?- findall(N, ('OTUTable'(A, B, C, D, E, F), atom_number(D, N)), Ns), sort(Ns, SNs).
Ns = [1, 1, 1, 1, 1, 1, 1, 1, 1|...],
SNs = [1, 2, 3, 4, 5, 6, 7, 8, 9|...].
But when it is used in the body of another predicate I get:
ERROR: atom_number/2: Type error: `atom' expected, found `1'
Is the `' wrapping the 1 giving more information that I cannot decode? :-)
-- Steve
BTW: I am using:
Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 6.3.3-17-gf077dc2) on Ubuntu 12.04