ichiban / prolog

The only reasonable scripting engine for Go.
MIT License
634 stars 32 forks source link

Empty list ambiguity #296

Closed amimart closed 1 year ago

amimart commented 1 year ago

Description

When comparing an empty list [] with the '[]' atom, it is considered equal.

How to reproduce

This issue can be easily reproduced using the provided interactive interpreter cmd/1pl:

?- [] = '[]'.
true

I'd be happy to have your thoughts about that, if I can be of any help it'll be a pleasure :)

pmoura commented 1 year ago

The empty list is an atom in ISO Prolog Core standard and in almost all Prolog systems (*). There's no bug here.

(*) The only exception is SWI-Prolog which made the (questionable and very publicly criticized decision) to make [] its own type in release 7.x.

amimart commented 1 year ago

Oh I see, thanks @pmoura :)