home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / TESTS / LF / ENCAPSUL.LF < prev    next >
Text File  |  1996-06-04  |  497b  |  14 lines

  1. % Encapsulated object-oriented process without streams:
  2.  
  3. main(C) :- counter(C,0).
  4.  
  5. putt(X,C) :- C=[X|C2], C<-C2.
  6.  
  7. counter([inc|S],V) -> counter(S,V+1).
  8. counter([show|S],V) -> counter(S,V) | write(V), nl.
  9. counter([set(X)|S],V) -> counter(S,X).
  10. counter([see(X)|S],V) -> counter(S,V) | X=V.
  11. counter([stop|S],V) -> true | write("counter closed with stop.").
  12. counter([_|S],V) -> counter(S,V) | write("message not understood."), nl.
  13. counter(nil,V) -> true | write("counter closed with end-of-stream.").
  14.