Exemplo n.º 1
0
Arquivo: core.py Projeto: jdmcbr/logpy
def bind(stream, goal):
    """ Bind a goal to a stream

    inputs:
        stream - sequence of substitutions (dicts)
        goal   - function :: substitution -> stream

    """
    return unique_dict(interleave(it.imap(goaleval(goal), stream)))
Exemplo n.º 2
0
Arquivo: core.py Projeto: jdmcbr/logpy
 def goal_conde(s):
     return unique_dict(interleave(bindstar((s,), *goals)
                                  for goals in goalseqs))
Exemplo n.º 3
0
 def allgoal(s):
     g = goaleval(reify(goals[0], s))
     return unique_dict(interleave(
         goaleval(reify((lall,) + tuple(goals[1:]), ss))(ss)
         for ss in g(s)))