Re: Remarks on SWI 7

Boris Vassilev <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAFw8osKPaSb3ikKT_uBFnHo1x099VZOFK86XocHyRg6rQ1iGvg@mail.gmail.com>
On Thu, Nov 28, 2013 at 8:38 AM, Richard A. O'Keefe <[email protected]>wrote:

> the empty list (ALONE amongst the vast range of atoms used to
> terminate recursive structures)
>

I foresee a future in which young SWI-Prolog programmers use [] everywhere
as *the terminator*, or *the empty thing*, or *not a value*. Like,

    bin_tree(a, bin_tree(b, [], []), bin_tree(c, [], [])).

or maybe:

    % Add all numbers, ignoring missing values
    sum([], 0).
    sum([X|Xs], Sum) :-
        sum(Xs, Sum_rest),
        (   X == []
        ->  Sum = Sum_rest
        ;   Sum is Sum_rest + X
    ).

People are shaking their heads, "O brave new world, that has such code in
it."

I find it difficult to explain why this is not a valid approach.
-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.