From 93af8ea9fcfd06844c093bde1fb45e71b4549090 Mon Sep 17 00:00:00 2001
From: Guilhem Gamard <guilhem.gamard@normale.fr>
Date: Mon, 10 Feb 2020 11:55:39 +0100
Subject: [PATCH] Fixed node_constant

---
 simra.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/simra.py b/simra.py
index 452c5f0..9bfb3b0 100755
--- a/simra.py
+++ b/simra.py
@@ -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)
 
 # ################################################################
-- 
GitLab