Set Key and Value Add Property

output of function store_compute where input key is key, value is value, map is [ ], and processed map is kvs = reverse of [ entry key: value, kvs ]

When all the entries have been processed but we did not encounter key, then the key does not exist in the map, so we prepend key:value as a new entry. In addition, the entries in "processed" are in reverse order from the original map, so let's reverse "processed" to correct the order of entries.

Examples

output of function store_compute where input key is "TX", value is "Texas", map is [ ], and processed map is [ entry "FL": "Florida", [ entry "AZ": "Arizona", [ ] ] ] = reverse of [ entry "TX": "Texas", [ entry "FL": "Florida", [ entry "AZ": "Arizona", [ ] ] ] ]

output of function store_compute where input key is "EST", value is "Eastern Time", map is [ ], and processed map is [ entry "PST": "Pacific Time", [ ] ] = reverse of [ entry "EST": "Eastern Time", [ entry "PST": "Pacific Time", [ ] ] ]

Quiz (1 point)

The result of setting "city" to "Sydney" in remaining entries

[ ]

and processed entries:

[ entry "name":"James", [ ] ]

is equal to the reverse of

_____________

Become a subscriber to save your progress, see the correct answer, and more!

Comments

Please log in to add comments