trealla-prolog / trealla

A compact, efficient Prolog interpreter written in plain-old C.
MIT License
268 stars 13 forks source link

support `functor()` syntax #502

Closed alephpi closed 7 months ago

alephpi commented 7 months ago

Hi, I'm moving from swi-prolog to trealla-prolog and I found there is a difference on syntax of a functor with empty argument.

For trealla-prolog, functor with empty args is just an syntax error. Here is a minimal reproduction: https://php.energy/trealla.html?share=5fe36135-4405-4bcc-8b1c-9bf401ceb87c

But in swi-prolog, it accepts such syntax. image

I just wonder if this is designed on purpose. For the moment, I add a placeholder(e.g. functor('null')) as a workaround.

Thank you for your attention!

infradig commented 7 months ago

Hi,

It's because it's not ISO Prolog standard syntax. Only SWI prolog & XSB (that I am aware) accept such syntax.

On Sun, Feb 18, 2024 at 9:55 PM 润心 @.***> wrote:

Hi, I'm moving from swi-prolog to trealla-prolog and I found there is a difference on syntax of a functor taking on empty arg.

For trealla-prolog, functor with empty args is just an syntax error. Here is a minimal reproduction: https://php.energy/trealla.html?share=5fe36135-4405-4bcc-8b1c-9bf401ceb87c

But in swi-prolog, it accepts such syntax. image.png (view on web) https://github.com/trealla-prolog/trealla/assets/61275421/5cfdc764-635c-4ba2-bfd3-bdeab48c855e

I just wonder if this is designed on purpose. For the moment, I add a placeholder(e.g. functor('null')) as a workaround.

Thank you for your attention!

— Reply to this email directly, view it on GitHub https://github.com/trealla-prolog/trealla/issues/502, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNKSEQX6H4KPGRGOLKD2FTYUHT4FAVCNFSM6AAAAABDODC5XSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2DAOJVGM2DKMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

alephpi commented 7 months ago

Alright, I see.