Example

Suppose you are constructing a linguistic database with a syntax tree of Words, Phrases, and Clauses, as in this example.

How do you assign monads?

You probably have some in-memory representation of the syntax tree. This should be traversable both up and down the tree. Let us also assume that you have a linked list of the words.

  1. Start by assigning monads to the words. We will assume that a word occupies a single monad. Go through the linked list of words, starting at the first word of the text (assigning the monad set {1}), then going further to the next word, assigning monad set {2}, etc. until you reach the end of the text.
  2. You now need to assign monads to the syntax-level units. Start at the top-level nodes (paragraphs). Go depth-first into the tree until you reach the word-level.
  3. At the level just above words (phrase-level), assign monads by using the Emdros set of monads class and using its union operator to union the sets of all the constituent words together.
  4. Go upwards in the tree, at each level using the union operator on the Emdros set of monads to union together the sets of the constituents. Then assign that monad set to that particular object, then move one step further up and repeat the process.
  5. Once you hit the top, you will have assigned all objects their monads.

Previous:Summary
Up:Monad assignment
Next:none