fmod SERVICE-TABLE is
  inc DATA .
  inc STRING .
  sort ServiceTable .
  op none : -> ServiceTable .
  sorts ServiceEntry .
  subsort ServiceEntry < ServiceTable .
  op _,_ : ServiceTable  ServiceTable ->  ServiceTable 
             [ctor assoc comm id: none] .
  op _:=_ : String Data -> ServiceEntry .
  op noEntry : -> ServiceEntry .

  op svcName : ServiceEntry -> String .
  eq svcName(q:String := sp:Data) = q:String .

  op svcProxy : ServiceEntry -> Data .
  eq svcProxy(q:String := sp:Data) = sp:Data .

  op lookup : ServiceTable String -> ServiceEntry .
  eq lookup(none,q:String) = noEntry .
  eq lookup((svcE:ServiceEntry,st:ServiceTable),q:String) = 
      if svcName(svcE:ServiceEntry) == q:String 
      then svcE:ServiceEntry
      else lookup(st:ServiceTable, q:String)
      fi  .
endfm

