Re: DCG

"Richard A. O'Keefe" <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 11/07/2013, at 8:09 AM, Josef Frydl wrote:

> Is there a way in DCG, to specify, that I want only the shortest solution, satisfying the Grammar rule?

There is a pretty well known way using the idea of iterative deepening.

shortest(X) :-
    length(Solution, _),
    phrase(your_grammar, Solution, []),
    !,
    X = Solution.

I have probably misunderstood.
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.