This function requires an immutable hash table. To scan the keys in a mutable hash table, use scan(keys x, f).