I have a huge term, which can't be read using read_canonical because it says too many variables.
But the regular read does work. Is the limit on the number of vars different for read_canonical?
The term is attached.
You can check these two queries:
?- see(term), read_canonical(X), seen.
?- see(term), read(X), seen.
and see the difference.
Note that read/1 is written in a mixture of Prolog and C, while read_canonical is written entirely in C. So read_canonical keeps variables in an array of length MAXVAR which is set to 1000 in context.h.
Of course, read_canonical should actually use a globally allocated array, and realloc whenever necessary. I've changed a number of tabling routines (which are also written in C) to do that over the years, but never made the change with read_canonical.
We should put this onto our bug list, but in the mean time, you should be able to get around this limit by setting the definition of MAXVAR to something higher than 1000 and recompiling XSB.
Log in to post a comment.