The more efficient strategy is to skip the generation step and pass the entire list to the lower level predicates, which in turn will take the grammatical portion of the sentence they are looking for from the front of the list and return the remainder of the list. Here then is the first grammar rule using difference lists. A list S is a sentence if we can extract a nounphrase from the beginning of it, with a remainder list of S1, and if we can extract a verb phrase from S1 with the empty list as the remainder. They too must be difference lists. They are simple.
Testing shows how the difference lists work.
It allows sentences to have any number of adjectives before a noun. These rules can now be used to test sentences. Notice how the binding of the variable representing the remainder list has been deferred until the lowest level is called. Each level unifies its remainder with the level before it, so when the vocabulary level is reached, the binding of the remainder to the tail of the list is propagated back up through the nested calls. Now that we have the noun phrase, we can see if the remainder is a verb phrase.