Exemplo n.º 1
0
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
    ))
Exemplo n.º 2
0
def item_iterator(asker, d):
    return lists.iterator(asker, lists.from_dict(d))
Exemplo n.º 3
0
def render_dict(asker, x):
    return asker.reply(answer=strings.concat(
        T.from_str("D"),
        lists.from_dict(x)
    ))