示例#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
    ))
示例#2
0
def set_visibile_children(asker, object, new_value):
    return asker.ask_tail(fields.set_field(all_children(), object, new_value))