Empty lists
JCumin opened this issue · 4 comments
There are problems in the transpiler with empty lists, e.g. ,[].
causes an error.
Maybe this is related, but at least only for your information: SWI-Prolog has made the unfortunate decision to deviate from the Prolog standard in that []
is no longer an atom. So, if you are using atom/1
in order to detect nil, this no longer works with SWI 7:
?- atom([]). false.
Well, good to know, this is almost certainly the problem.
The error is on a call to atomic_list_concat
which fails when the Input variable is the empty list, since it is not an atom as you say.
Yes. This unfortunate decision will likely haunt SWI-Prolog users for many years into the future. Please consider filing issues about such discrepancies in the SWI-Prolog repository (swipl-devel
). I hope that if more users are continuously repulsed by such problems, SWI-Prolog will reconsider this decision. Thank you!
Fixed by adding a special case for the empty list in variables unification in transpile_