Please Make a Donation:
Support This Project

Hosted by:
Get Python Knowledge Engine (PyKE) at Fast, secure and Free Open Source software downloads

Literal Patterns

You want to ask Pyke a question. The simplest questions are just asking "Is statement X true?". Going back to Pyke's family_relations example, your Python program might want to know whether it's really true that Bruce's parents are Thomas and Norma? So it would ask whether the following statement is true:

family.son_of(Bruce, Thomas, Norma)

Pyke would search the facts that's it's been told about and answer "thumbs up" because you've told it before that this statement is true and it has remembered that.

In this case, all of the statement's arguments are literal patterns. You might consider literal patterns to be input to Pyke. You're passing Bruce, Thomas and Norma into Pyke. And Pyke just answers "thumbs up" or "thumbs down".

Literal patterns look exactly like data. Thus, your question would look exactly like you see above.


Literal Patterns

Explanation of literal patterns.

Pattern Variables

Explanation of pattern variables.

Tuple Patterns

Explanation of tuple patterns.

Matching Two Patterns

Explanation of matching two patterns together, vs matching a pattern to data.

Page last modified Mon, Oct 27 2008.