當前位置: 首頁>>代碼示例>>Python>>正文


Python Term.from_list方法代碼示例

本文整理匯總了Python中term.Term.from_list方法的典型用法代碼示例。如果您正苦於以下問題:Python Term.from_list方法的具體用法?Python Term.from_list怎麽用?Python Term.from_list使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在term.Term的用法示例。


在下文中一共展示了Term.from_list方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: visible_children

# 需要導入模塊: from term import Term [as 別名]
# 或者: from term.Term import from_list [as 別名]
def visible_children(asker, object):
    expanded = convert.check_hard(asker, is_expanded(), object)
    object = asker.refresh(object)
    if not expanded:
        return asker.reply(answer=T.from_list([]))
    else:
        children = asker.ask(fields.get_field(all_children(), object)).firm_answer
        return asker.reply(answer=children)
開發者ID:paulfchristiano,項目名稱:interpreter,代碼行數:10,代碼來源:outlines.py

示例2: add_children_on_expanded

# 需要導入模塊: from term import Term [as 別名]
# 或者: from term.Term import from_list [as 別名]
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
    ))
開發者ID:paulfchristiano,項目名稱:interpreter,代碼行數:18,代碼來源:outlines.py

示例3: T

# 需要導入模塊: from term import Term [as 別名]
# 或者: from term.Term import from_list [as 別名]
import convert
import representations
import properties
import updates
import outlines
import builtins
import computations
import term
import termtypes
import state
import views
import functions
import strings
from term import Term as T

k = updates.update(updates.trivial(), T.from_int(0))
d = T('test [a]', a=k)
Q = T('a question about [this]', this=k)
asker = ask.Asker(Q)

a = T('a')
b = T('b')
c = T('c')

l1 = T.from_list([a, b, c])
l2 = T.from_list([a, a, a])

l12 = lists.zip(l1, l2)

d = dictionaries.from_items(l12)
開發者ID:paulfchristiano,項目名稱:interpreter,代碼行數:32,代碼來源:script.py

示例4: render_char

# 需要導入模塊: from term import Term [as 別名]
# 或者: from term.Term import from_list [as 別名]
def render_char(asker, x):
    return asker.reply(answer=T.simple_str(T.from_list([c])))
開發者ID:paulfchristiano,項目名稱:interpreter,代碼行數:4,代碼來源:views.py

示例5: get_starting_view

# 需要導入模塊: from term import Term [as 別名]
# 或者: from term.Term import from_list [as 別名]
def get_starting_view(asker, query):
    head = fields.get(asker, representations.head(), query)
    bindings = fields.get(asker, representations.bindings(), query)
    initial_lines = T.from_list([head, T.from_str("---")])
    return asker.reply(answer=view(initial_lines, bindings))
開發者ID:paulfchristiano,項目名稱:interpreter,代碼行數:7,代碼來源:views.py

示例6: make_list_expr

# 需要導入模塊: from term import Term [as 別名]
# 或者: from term.Term import from_list [as 別名]
def make_list_expr(l):
    return T(make_list_expr.head, l=T.from_list(l))
開發者ID:paulfchristiano,項目名稱:interpreter,代碼行數:4,代碼來源:parsing.py


注:本文中的term.Term.from_list方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。