Skip to content
Snippets Groups Projects
Commit 93af8ea9 authored by Guilhem Gamard's avatar Guilhem Gamard
Browse files

Fixed node_constant

parent d0da03de
No related branches found
No related tags found
No related merge requests found
......@@ -236,15 +236,24 @@ def periodic_mode(mode):
# Trivial nodes
def node_fixpoint(name, init_val=0):
"""
Return a node that depends only on itself and updates to its own value.
"""
def identity(args):
for k in args.keys():
return args[k]
return Node(name, identity, [name], init_val)
def node_constant(name, value=0, init_val=value):
def node_constant(name, value=0, init_val=None):
"""
Return a node that depends on nobody and update to the given value.
"""
if not init_val: init_val=value
def constant(args):
nonlocal value
return value
return Node(name, constant, [], init_val)
# ################################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment