Chapter #4 Examples in Oz %%%%%%%%%%%%%%%%%%% Chapter - 4 %%%%%%%%%%%%%%%%%%%%%% % 4.11 {Browse 11#(hummus#steak#green#torte)} % 4.12 {Browse 12#(torte#hummus#steak#sundae)} % 4.18 {Browse 18#(shrimp#sundae)} % 4.25 fun {AddASteak X} case X of shrimp then shrimp#steak [] calamari then calamari#steak [] escargots then escargots#steak [] hummus then hummus#steak end end % 4.21 {Browse 21#{AddASteak shrimp}} % 4.22 {Browse 22#{AddASteak hummus}} % 4.28 {Browse 28#{AddASteak escargots}} % 4.42 fun {EqMain_ X} case X of steak#steak then true [] steak#ravioli then false [] steak#chicken then false [] steak#eggplant then false [] ravioli#steak then false [] ravioli#ravioli then true [] ravioli#chicken then false [] ravioli#eggplant then false [] chicken#steak then false [] chicken#ravioli then false [] chicken#chicken then true [] chicken#eggplant then false [] eggplant#steak then false [] eggplant#ravioli then false [] eggplant#chicken then false [] eggplant#eggplant then true end end % 4.46 fun {EqMain X} case X of steak#steak then true [] ravioli#ravioli then true [] chicken#chicken then true [] eggplant#eggplant then true [] _#_ then false end end % 4.54 fun {HasSteak X} case X of _#steak#_ then true [] _#_#_ then false end end % 4.48 {Browse 48#{HasSteak hummus#ravioli#sundae}} % 4.49 {Browse 49#{HasSteak shrimp#steak#mousse}} % 4.56 {Browse 56#{HasSteak 5#steak#true}} % 4.64 {Browse 64#{HasSteak 5#ravioli#6}} % 4.67 fun {AddASteak_ X} X#steak end |