Scryer-prolog: Ability to export only an operator from a module (without associated predicate)

Created on 30 Oct 2019  Â·  5Comments  Â·  Source: mthom/scryer-prolog

For example, CLPZ(ℤ) needs to export .. as an operator, without any predicate definition.

As a workaround, I currently pretend to export the predicate (..)/2, and this seems to make the operator available. See for example line 59 of https://www.metalevel.at/clpz/scryer/clpz3.pl

Without this workaround, I get:

?- T = (X in 1..5).
caught: error(syntax_error(incomplete_reduction),read_term/2:1)

Expected: T = (X in 1..5).

It would be nice to have a better way for this use case.

Most helpful comment

I also suppose that exporting the operator won't also result in exporting the associated predicate, as it does now. If you want that to be done also, it needs to be exported separately.

All 5 comments

I have been thinking of how to do this for a while. Something like,

:- module(m, [op(400,xfy,#>), ...])

perhaps?

Yes, that would be perfect! In this way, any operators can be exported in addition to all predicates.

I also suppose that exporting the operator won't also result in exporting the associated predicate, as it does now. If you want that to be done also, it needs to be exported separately.

Yes!

This now works, so I am closing this issue. Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

notoria picture notoria  Â·  4Comments

triska picture triska  Â·  3Comments

triska picture triska  Â·  4Comments

mkohlhaas picture mkohlhaas  Â·  3Comments

UWN picture UWN  Â·  4Comments