Let's check out different ways of expressing "if-then-else" in Prolog! To express list (non-)membership in a pure way, we define: negated condition non_P is non_member(,X),. ![]() We can match above pattern (" If P then Q else R") if. If X is a member of list then X equals 2 else X equals 4. Let's take the following concrete example: How can we express "if-then-else" like that in Prolog? ![]() " If P then Q else R" is equivalent to "(P and Q) or (non_P and R)". First, let's recall some classical first order logic:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |