Yes, the graph is equivalent to an s-expr (with subgraphs being nested scopes).
The reason that I’m not just representing the graph as a single expression is
for
efficiency – I’m doing incremental updates and change tracking, so you can
update
one of the node's expressions and have the changes propagate through the graph
with a minimum number of re-evaluations.
A similar Python engine is documented here:
http://www.mattkeeter.com/projects/graph/
Matt [and List],
Sorry if your reply bounced, I was having email issues today. :(
Wow, I think I finally comprehend what you are doing. I seem to
remember looking at the code for a 3D scene graph in Scheme--where
escapes me right now. I think they used Scheme "promises" to cache
values, again a lambda technique.
In any event, if you are translating from Python, I would encourage you
to rethink what you are doing in light of Scheme's facilities. A
constraint solver might be straight-forward, as well. Scheme is really
good at what you are trying to do, built-in.
[
And if anyone else has ideas on this topic of optimizing the update of
an S-exp as Matt has explained--I would be interested too. It would be
awesome to have something like Matt's Antimony done in Guile, trust me:
http://www.mattkeeter.com/projects/antimony/3/
]
Have fun,
(Basa)