Questions tagged [implicit-state-passing]

Use this tag when using implicit state passing with Prolog DCG (Definite Clause Grammar).

References

4 questions
6
votes
2 answers

How to avoid using assert and retractall in Prolog to implement global (or state) variables

I often end up writing code in Prolog which involves some arithmetic calculation (or state information important throughout the program), by means of first obtaining the value stored in a predicate, then recalculating the value and finally storing…
3
votes
1 answer

Applying semicontext for passing additional arguments

This is a follow-on question from an earlier question from Mat's answer Starting with this e([number(0)] , t1 , Uc0 , Uc0, Bc0 , Bc0) --> []. e([number(1)] , t2 , Uc0 , Uc0, Bc0 , Bc0) -->…
Guy Coder
  • 24,501
  • 8
  • 71
  • 136
3
votes
2 answers

How to enumerate combinations using DCGs with CLP(FD) and multiple constraints

This question starts from Mat's answer to Algorithm improvement for enumerating binary trees which has only one input value that determines the number of all nodes for the binary tree, and the need to be able to have two input values with one being…
Guy Coder
  • 24,501
  • 8
  • 71
  • 136
1
vote
1 answer

Dcg state implementation of algorithm

The distance between a long sequence and a short sequence, is the minimum distance between the short sequence and any subsequence of the long sequence that is the same length as the short sequence. The distance I am using is I think the Manhattan…
user27815
  • 4,767
  • 14
  • 28