def add_children_on_expanded(asker, old, new, bindings): children = [] for p in lists.iterator(asker, lists.from_dict(bindings)): k = asker.ask(fields.get_field(first(), p)).firm_answer v = asker.ask(fields.get_field(second(), p)).firm_answer prefix = strings.string_concat(k, T.from_str(": ")) new_node = node_from_term(asker, v) new_node = updates.update( updates.apply_to(headline(), strings.prepend_str(prefix)), new_node ) children.append(new_node) return asker.reply(answer=updates.update( fields.set_field(all_children(), T.from_list(children)), new ))
def item_iterator(asker, d): return lists.iterator(asker, lists.from_dict(d))
def render_dict(asker, x): return asker.reply(answer=strings.concat( T.from_str("D"), lists.from_dict(x) ))