[m-users.] Avoiding a segmentation violation caused by a DCG
Mark Brown
mark at mercurylang.org
Wed Oct 19 14:10:37 AEDT 2022
On Wed, Oct 19, 2022 at 1:33 PM Razetime <rraghu.11502 at gmail.com> 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
> users at lists.mercurylang.org
> https://lists.mercurylang.org/listinfo/users
More information about the users
mailing list