Add list types
under review
Kelly Eldritch
Hashes and arrays:
myHash = [key: value, key: value]
myArray = [value, value, value]
What we get out of these.
-- The ability to compare two separate totals eg. Comparing prices of a set of products from two different stores.
-- The ability display the difference of the values of two hashes that have matching keys.
-- The ability to collect data that we calculate in an easy to reason about object and then display those values later in the page within text. (this would be in valuable when combined with hiding calculations)
Personally I would implement his as a singe type like PHP's arrays which can be indexed or hashed.
No need to introduce loops, just some pre defined iterators:
## Mathematical operators
Iterates both hashes and where keys match, execute the operator used.
eg. hash1 + hash2: iterates both hashes and returns a new hash were matching keys have been added together
## sum
iterates the hash or array returning a the sum of the values in the array or hash
## Average
iterates the hash or array and gives the average of the values.
## Display
Banana Cream Pi
scale = 1
crust = []
meringue = []
filling = []
crust[flower] = 1 cup * scale
crust[butter] = 0.5lbs * scale
meringue[eggwhites] = 8 * scale
meringue[sugar] = 1 cup * scale
filling[bananas] = 4 * scale
filling[sugar] 1 cup * scale
filling[gelatin] 2 tblsp* scale
Ingredients:
## Crust
flower crust[flower]
butter crust[butter]
etc...
Begin by making your crust put crust[flower] flower and crust[butter] softened butter in a large mixing bowl. etc...
C
Carsten Schlegel
Great was support of JSON.
array = [1,2,3]
obj = { key: value, key: value, min: 2 }
And combines.
JSON was a standard (easy to implement and understand).
Accessing elements like JavaScript
5 + array[1]
5 + obj.min
and please: zero based ;-)
Zac @ Soulver
under review
Thank you for the detailed suggestion. My current feeling is that data structures are the point where you might want to jump to a tool like Swift Playgrounds.
Kelly Eldritch
Oh, that could have been more efficient:
#Banana Cream Pi
scale = 1
crust = []
meringue = []
filling = []
crust[flower] = 1 cup
crust[butter] = 0.5 lbs
crust[salt] = 1 tsp lbs
crust[sugar] 0.25 cups
crust * scale
meringue[eggWhites] = 8
meringue[sugar] = 1 cup
meringue * scale
filling[bananas] = 4 bananas
filling[sugar] 1 cup
filling[gelatin] 2 tbsp
filling * scale
Ingredients:
## Crust
flower crust[flower]
butter crust[butter]
etc...
Begin by making your crust put crust[flower] flower and crust[butter] softened butter in a large mixing bowl. etc...