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.