3.5.1 Implementation

The implementation is provided as functor SmallTest (see Section A.3).

<SmallTest.oz>=
functor 
import 
   QTk at 'http://www.info.ucl.ac.be/people/ned/qtk/QTk.ozf' 
   Application
   SmallLexicon
   Browser(browse:Browse)
define 
   DetBox AdjBox NounBox
   DetWords = ['*no determiner*' 
               der den dem des die das
               ein einen einem eines eine einer]
   AdjWords = [schöne schönen schöner schönes schönem]
   NounWords= [mann mannes männer männern]
   proc {Try}
      {Browse
       try 
          D = {Nth DetWords  {DetBox get(firstselection:$)}}
          A = {Nth AdjWords  {AdjBox get(firstselection:$)}}
          N = {Nth NounWords {NounBox get(firstselection:$)}}
       in 
          {SmallLexicon.agreement
           decode(
              {SmallLexicon.get D}=
              {SmallLexicon.get A}=
              {SmallLexicon.get N} $)}
       catch _ then error end}
   end 
   Interface =
   lr(listbox(init:DetWords  glue:we exportselection:false handle:DetBox)
      listbox(init:AdjWords  glue:we exportselection:false handle:AdjBox)
      listbox(init:NounWords glue:we exportselection:false handle:NounBox)
      newline
      button(text:'Try' glue:we action:Try)
      empty
      button(text:'Quit' glue:we
             action:proc {$} {Application.exit 0} end))
   Window = {QTk.build Interface}
   {Window show}
end


Denys Duchier
Version 1.2.0 (20010221)