[m-users.] parsing, seeking advice on simple combinator project and also operators.

Julien Fischer jfischer at opturion.com
Sun Oct 30 19:54:21 AEDT 2022


On Sun, 30 Oct 2022, Sean Charles (emacstheviking) wrote:

> Yes, I was already aware of that,. part of my question was, "What
> modules define those operators?" as it would make it easier to try to
> re-use one.

Lots of modules in the standard library define operators: int*, uint*,
float, string, list, builtin, cord, integer, rational, prolog ...

> If I had included 'int', and still wanted to use, '<' for my own
> purposes, I am assuming that I could use
>
> :- use_module int.

If you add a definition for '<', then an ambiguity will only arise
with the one exported by the int module if the type checker cannot
distinguish them based on the operand types. For example, if your
module defines:

     :- pred (int::in) < (int::in) is semidet.

or:

     :- pred (T::in) < (T::in) is semidet.

In that case you would need to add module qualifiers in order to resolve
the ambiguity.

> and then qualify the real '<' somehow, not sure what the synta would be
>
>    X int.'<' Y    perhaps?

It's done like this:

     int.(X < Y)

Julien.


More information about the users mailing list