Chapter #1 Examples in Oz %%%%%%%%%%%%%%%%%%% Chapter - 1 %%%%%%%%%%%%%%%%%%%%%% % 1.1 {Browse 1#{IsInt 5}} % 1.2 {Browse 2#{IsInt ~23}} % 1.3 {Browse 3#{IsInt 5.32}} % 1.4 {Browse 4#{IsInt 5}} % 1.5 {Browse 5#{IsInt 19}} % 1.6 {Browse 6#{IsBool true}} % 1.7 {Browse 7#{IsBool true}} % 1.14 class SeasoningD end class Salt from SeasoningD meth init skip end end class Pepper from SeasoningD meth init skip end end % 1.16 {Browse 16#{New Salt init}} % 1.17 {Browse 17#{New Pepper init}} % 1.21 class Thyme from SeasoningD meth init skip end end class Sage from SeasoningD meth init skip end end % 1.25 class PointD end class CartesianPt from PointD feat X Y meth init(Xi Yi) self.X = Xi self.Y = Yi end end class ManhattanPt from PointD feat X Y meth init(Xi Yi) self.X = Xi self.Y = Yi end end % 1.28 {Browse 28#{New CartesianPt init(2 3)}} % 1.29 {Browse 29#{New ManhattanPt init(2 3)}} % 1.34 class NumD end class Zero from NumD meth init skip end end class OneMoreThan from NumD feat Predecessor meth init(P) self.Predecessor = P end end % 1.35 {Browse 35#{New Zero init}} % 1.36 {Browse 36#{New OneMoreThan init({New Zero init})}} % 1.40 {Browse 40#{New OneMoreThan init( {New OneMoreThan init( {New Zero init})})}} % 1.41 {Browse 41#{New OneMoreThan init(0)}} % 1.43 {Browse 43#{New OneMoreThan init( {New OneMoreThan init( {New OneMoreThan init( {New OneMoreThan init( {New Zero init})})})})}} % 1.53 class LayerD end class Base from LayerD feat O meth init(Oi) self.O = Oi end end class Slice from LayerD feat L meth init(Li) self.L = Li end end % 1.54 {Browse 54#{New Base init({New Zero init})}} % 1.55 {Browse 55#{New Base init({New Salt init})}} % 1.58 {Browse 58#{New Base init(5)}} % 1.59 {Browse 59#{New Base init(false)}} % 1.60 class Integer feat X meth init(Xi) self.X = Xi end end {Browse 60#{New Base init({New Integer init(5)})}} % 1.61 class Boolean feat X meth init(Xi) self.X = Xi end end {Browse 61#{New Base init({New Boolean init(false)})}} |