By eliminating the more difficult task for the school, I discovered a mistake that I made when I was processing a single list of items (a stack with one item), as if it were a separate item. I solved my problem, however during further testing I noticed something strange:
48 ?- 1 is [1].
true.
49 ?- -1 is [-1].
ERROR: is/2: Type error: `character' expected, found `-1'
50 ?- 0.66 is [0.66].
ERROR: is/2: Type error: `character' expected, found `0.66'
A similar behavior occurs using =: = / 2 instead of is / 2. Therefore, for some reason, one list of elements is considered the same as one element, but only for non-negative integers.
Curiosity is more than anything ... does anyone know why this is?
Thank!
source
share