learn prolog now phần 7 pot
... sentence from the parse tree of its subparts. 106 Chapter 7. Definite Clause Grammars 7. 4 Practical Session 7 The purpose of Practical Session 7 is to help you get familiar with the DCGs, differ- ence ... Furthermore, we now take advantage of Prolog s first argument indexing which makes looking up a word in the lexicon more efficient. First argument indexing is a technique for making...
Ngày tải lên: 12/08/2014, 20:22
learn prolog now phần 8 potx
... 1is3+-2. When we learned about arithmetic in Prolog, we saw that Prolog knows about the con- ventions for disambiguating arithmetic expressions. So, when we write 2+3*3 for example, Prolog knows that ... Exercises 139 ?- 12 is 2*6 ?- 14 =\= 2*6 ?- 14 = 2 *7 ?- 14 == 2 *7 ?- 14 \== 2 *7 ?- 14 =:= 2 *7 ?- [1,2,3|[d,e]] == [1,2,3,d,e] ?- 2+3 == 3+2 ?- 2+3 =:= 3+2 ?- 7- 2 =\= 9-2 ?-p==’...
Ngày tải lên: 12/08/2014, 20:22
Learn Prolog Now phần 5 ppt
... 3 is +(1,2). 7. 3 is X+2. 8. X is 1+2. 9. 1+2 is 1+2. 10. is(X,+(1,2)). 11. 3+2 = +(3,2). 12. * (7, 5) = 7* 5. 13. * (7, +(3,2)) = 7* (3+2). 14. * (7, (3+2)) = 7* (3+2). 15. * (7, (3+2)) = 7* (+(3,2)). Exercise ... 2 3 3 is 6/2. 7 2 3 3 is 7/ 2. 1 is the remainder when 7 is divided by 2 1 is mod (7, 2). (Note that as we are working with integers, division gives us back an integer an...
Ngày tải lên: 12/08/2014, 20:22
Learn Prolog Now phần 6 docx
... query s([a,woman,shoots],[])? Prolog gets into an infinte loop. Can you see why? The point is this. Prolog translates DCG rules into ordinary Prolog rules. If we place the recursive rule s -> s,conj,s in the knowledge ... end of the knowledge base, so that Prolog always ecounters the translation of the non-recursive rule first. What happens now, when we pose the query s([a,woman,sho...
Ngày tải lên: 12/08/2014, 20:22
learn prolog now phần 9 docx
... tool for learning how operators work in Prolog. So, before going on to learn more about how to write things onto the screen, try the following queries. Make sure you understand why Prolog answers ... chosen a value for Y. 4. Prolog then goes on, and by instantiating Y to 1, Prolog matches j(Y) with the fact j(1). So we have found a solution. 5. But we can find more. Prolog is free t...
Ngày tải lên: 12/08/2014, 20:22
learn prolog now phần 10 doc
... caroline List = [laura,rose] ; Child = _77 36 Mother = charlotte List = [caroline,laura,rose] ; Child = _77 36 Mother = laura List = [rose] ; Child = _77 36 Mother = martha List = [charlotte,caroline,laura,rose] ... you have to tell Prolog that this module is a library, so that Prolog knows where to look for it (namely, not in the directory where your other code is, but at the place where...
Ngày tải lên: 12/08/2014, 20:22