% $Id$ % Examples of Oz to illustrate semantics of the declarative kernel. local X in local Y in local Z in %% Value creation X=3 local Oh in local Kay in Oh = oh Kay = kay Y='#'(1: Oh 2:Kay) end end local NinetyNine in local TT in NinetyNine = 99 TT = 32 Z=zrec(z1:NinetyNine 1:TT) end end %% atoms vs. identifiers local X in X = x {Browse X} end {Browse X} {Browse Y} {Browse Z} end end end % FOR YOU TO DO % What's shown by the following? local D in D=drec(3 feature: atom) {Show rec(feature:3)} {Show D} end local D in local Three in Three = 3 local Atom in Atom = atom D = drec(1:Three feature:Atom) end end %% Unification local X1 X2 X3 X4 X5 X6 in {Browse store(x1:X1 x2:X2 x3:X3 x4:X4 x5:X5 x6:X6)} {Delay 5000} X1=X2 {Delay 2000} X3=X2 {Delay 2000} X5=label(name:7) {Delay 2000} X6=label(name:X1) {Delay 2000} X1=X4 {Delay 2000} X5=X6 end % FOR YOU TO DO % What's shown by the following? local Y1 Y2 Y3 Y4 Y5 Y6 Y7 in {Browse store(y1:Y1 y2:Y2 y3:Y3 y4:Y4 y5:Y5 y6:Y6 y7:Y7)} Y1=4020 Y2=Y3 Y4=aRecord(first:Y5 second: 1234) Y6=aRecord(second:Y7 first:999) Y4=Y6 Y4=Y2 end local X1 X4 in X1=X4 X1=3 X4=4 % error end