pc --> [ta] -> [tb] -> [tc] .
If I have tc
, how do I get [ta,tb]
put into a variable?
If I have the tail end of a list defined in a definite clause, how do I get the preceeding elements as a list of unknown length?
I am hoping that approach can be extended to a case where the prefix of a string known at the time of a query be extracted with the suffix removed.
For example, given "sweetness", use a DCG describing the suffix "ness" to bind "sweet" to a variable.
Do not only use 'append'.
The following examples are not part of the question, they are information for other people learning definite clauses up to this stage of complexity.
pa --> [ta] .
Can test with
phrase(pa,[ta]) .
To fill variable with match, do
phrase(ptrn,Variable) .
pb --> [ta] -> [tb] .
The head element can be gotten with
phrase(pb,[Head|[tb]]) .