def simple_lookup(asker, search_key, key, value, other): are_equal = asker.ask(equal(key, search_key)).answer #FIXME should avoid these cyclic imports import convert if are_equal is not None and convert.to_bool(asker, are_equal): return asker.reply(answer=value) else: return asker.ask_tail(lookup(other, search_key))
def translate_removal(asker, property, old, new, to_cut): if convert.to_bool(asker.ask(builtins.equal(to_cut, object)).firm_answer): return asker.reply(answer=new) else: return asker.reply(answer=properties.simple_add_modifier(new, property))