diff --git a/pages/cookbook/data-structures.mdx b/pages/cookbook/data-structures.mdx index 9206306d..0260caa7 100644 --- a/pages/cookbook/data-structures.mdx +++ b/pages/cookbook/data-structures.mdx @@ -18,9 +18,9 @@ Following example emulates an array using a [`map{:tact}`][map] wrapped import "@stdlib/deploy"; // for Deployable trait struct Array { - map: map; // array of Int values as a map of Ints to Ints, - // with serialization of its keys to uint16 to save space - length: Int = 0; // length of the array, defaults to 0 + m: map; // array of Int values as a map of Ints to Ints, + // with serialization of its keys to uint16 to save space + length: Int = 0; // length of the array, defaults to 0 } // Compile-time constant upper bound for our map representing an array. @@ -114,7 +114,7 @@ extends mutates fun deleteAll(self: Array) { // Global static function for creating an empty Array fun emptyArray(): Array { - return Array{map: emptyMap()}; // length defaults to 0 + return Array{m: emptyMap(), length: 0}; // length defaults to 0 } // Contract, with emulating an Array using the map @@ -171,9 +171,9 @@ Following example emulates a stack using a [`map{:tact}`][map] wrapped i import "@stdlib/deploy"; // for Deployable trait struct Stack { - map: map; // stack of Int values as a map of Ints to Ints, - // with serialization of its keys to uint16 to save space - length: Int = 0; // length of the stack, defaults to 0 + m: map; // stack of Int values as a map of Ints to Ints, + // with serialization of its keys to uint16 to save space + length: Int = 0; // length of the stack, defaults to 0 } // Compile-time constant upper bound for our map representing an stack. @@ -215,7 +215,7 @@ extends mutates fun deleteAll(self: Stack) { // Global static function for creating an empty Stack fun emptyStack(): Stack { - return Stack{map: emptyMap()}; // length defaults to 0 + return Stack{m: emptyMap(), length: 0}; // length defaults to 0 } contract MapAsStack with Deployable { @@ -272,10 +272,10 @@ Following example emulates a circular buffer using a [`map{:tact}`][map] import "@stdlib/deploy"; // for Deployable trait struct CircularBuffer { - map: map; // circular buffer of Int values as a map of Ints to Ints, - // with serialization of its keys to uint8 to save space - length: Int = 0; // length of the circular buffer, defaults to 0 - start: Int = 0; // current index into the circular buffer, defaults to 0 + m: map; // circular buffer of Int values as a map of Ints to Ints, + // with serialization of its keys to uint8 to save space + length: Int = 0; // length of the circular buffer, defaults to 0 + start: Int = 0; // current index into the circular buffer, defaults to 0 } // Compile-time constant upper bound for our map representing a circular buffer. @@ -324,7 +324,7 @@ extends mutates fun deleteAll(self: CircularBuffer) { // Global static function for creating an empty CircularBuffer fun emptyCircularBuffer(): CircularBuffer { - return CircularBuffer{map: emptyMap()}; // length and start default to 0 + return CircularBuffer{m: emptyMap(), length: 0, start: 0}; // length and start default to 0 } // This contract records the last 5 timestamps of when "timer" message was received