This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deep merge | |
# | |
# - Write a function that takes two hashes and returns a new hash containing the | |
# keys and values from both hashes. | |
# - Neither input should be modified. | |
# - If the key exists in both hashes... | |
# ...merge the values if they are both hashes. | |
# ...give the values in the second hash (b) precedence otherwise. | |
def merge(a, b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deep merge | |
# | |
# - Write a function that takes two dictionaries and returns a new dictionary | |
# containing the keys and values from both dictionaries. | |
# - Neither input should be modified. | |
# - If the key exists in both dictionaries... | |
# ...merge the values if they are both dictionaries. | |
# ...give the values in the second dictionary (b) precedence otherwise. | |
def merge(a, b): |