Recently started woring with prolog and decided to make a text documenting my annoyances

Thanks for sharing. It is always good to have fresh comments. Several have a work-around.

column(Table, Column, Info)

As shown by @j4n_bur53. You can use term_expansion to make this work. The problem is of course that f(X=a(Y)) or f(X@a(Y)) have a meaning as is, and you are changing this. SWI-Prolog handles unifications to head arguments that immediately follow the head efficiently. So code like below uses clause indexing and does not create a copy of X. If you need a lot of that, I’d indeed introduce some abbreviated syntax. Possibly we should have a library for that.

f(X, ...) :-
    X = f(Y),
    ....
    g(X).

my_pred(…) :-
rule1,
rule2, % This comma is ignored
.

The standard trick is to use true. as last line. Of have an editor that is smart enough. I’m not aware of such an editor :frowning:

my_pred(…):-
rule1,
skip,
rule2. % Only rule 1 is checked

You can do that. Define a module skip with the code below. The operator precedence causes skip to take the remainder of the clause as argument. Next just just define it to be true. Also works in branches of a disjunction.

:- module(skip,
          [ (skip)/1,
            op(1000, fy, (skip))
          ]).

skip(_).

Type hints

Typing is a long debated topic. It probably needs to be reopened. In the old days we had fully typed languages. Now we have typing on dynamically typed languages such as typescript for JavaScript, types for Python, etc. The Ciao system is probably most advanced here. Hopefully something simple and useful will emerge …

.

2 Likes