curry.backends.py.graph.node module

class curry.backends.py.graph.node.Node(info, *args, target=None, partial_info=None, **kwds)[source]

Bases: object

A node in a Curry expression graph.

copy()[source]
static create_partial_applic(cls, info, *args, target=None, partial_info=None)[source]
forward_to(target)[source]
id()[source]
info
rewrite(info, *args, **kwds)[source]
set_successor(i, value)[source]
successor(i)[source]
successors
walk(path=None)[source]

See walkexpr.walk.

curry.backends.py.graph.node.check_int_range(value)[source]
curry.backends.py.graph.node.new_node(cls, info, *args, target=None, partial=False)[source]

Create or rewrite a node.

If the keyword ‘target’ is supplied, then the object will be constructed there. This low-level function is intended for internal use only. To construct an expression, use Interpreter.expr.

Parameters:
  • info – An instance of CurryNodeInfo or InfoTable indicating the kind of node to create.

  • *args – The successors. Each one should be a Node, built-in data object, or None. The value None is not a valid successor, but is used to construct cyclic expressions. These must be replaced before the object is used as an expression. The number of successors must equal info.arity, unless partial=True, in which case it should be strictly less.

  • target=None – Keyword-only argument. If not None, this specifies an existing Node object to rewrite.

  • partial=False – Indicates whether this constructs a partial application. If False, applying a function to too few arguments will cause TypeError to be raised.

Returns:

A Node.