5.5.3 Lexicon.oz

Functor Lexicon (see Section A.9) imports module Entry defined in the previous section, and exports function Get which takes an atom as an argument (representing the full form of a word) and returns the corresponding list of lexicon entries, or raises exception unknownword(Word) if the word does not appear in the lexicon.

import Entry
export Get
   Lexicon = {Dictionary.new}
   proc {PUT Word Spec}
      {Dictionary.put Lexicon Word
       {Entry.lexEncode Spec}|{Dictionary.condGet Lexicon Word nil}}
   fun {Get Word}
      try Lexicon.Word
      catch _ then 
         raise unknownword(Word) end 
<Lexicon entries> 

Denys Duchier
Version 1.2.0 (20010221)