Re: [m-users.] Avoiding a segmentation violation caused by a DCG

Mark Brown <[email protected]>
Newsgroups gmane.comp.lang.mercury.general
Message-ID <CAM4AczCaAbj47bHZpCQHU-uL_W4QE_8tAgVUcyCJudryUsQQZA@mail.gmail.com>
On Wed, Oct 19, 2022 at 1:33 PM Razetime <[email protected]> wrote:
> My assumption was that I could make this DCG tail recursive, or use
> semicontext notation to pass the final length through the states. How
> can I resolve this problem?

Introduce an accumulator for the length - pass in the initial value of
zero, and let pattern increment it.

I don't know what semicontext notation is, but In Mercury state
variables are suited to this purpose.

Mark

> _______________________________________________
> users mailing list
> [email protected]
> https://lists.mercurylang.org/listinfo/users
_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
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.