[Pipet Devel] overflow question
Brad Chapman
chapmanb at arches.uga.edu
Thu Jun 22 15:48:12 EDT 2000
Jarl wrote:
> ic. Why does Overflow use pulling? Nodes pushing data into the next
seems
> more logical
> to me at first.
Jean-Marc wrote:
> It's just that the pull is so much cleaner and easier to implement
for more
> complex processing.
Jarl, I was thinking the same way as you when I first starting
thinking about the pull stuff. I am probably simple minded, but the
first way I think to move through a data structure or anything is from
the front, using a push type system like you are describing, ie.
1. Calculate some data.
2. Pass the data on to the outputs.
3. Repeat until there are no more outputs to push the data on to.
4. Collect the results from the final outputs
However, I've been using the pull type system for stuff in the dl, and
it is really clean and easy to use, as Jean-Marc mentioned. Using the
pull scheme really falls naturally into some very nice recursion ie.
(example in python, sorry!):
def __main__():
the_nodes_that_need_results
calculate_data(the_nodes_that_need_results)
def calculate_data(node_to_calculate):
all_input_data = list(())
for input_node in node_to_calculate.all_input_nodes:
input_data = calculate_data(input_node)
all_input_data.append(input_data)
return node_to_calculate.do_calculation(all_input_data)
It took me a while to get into this, since I'm slow in the head, but I
really like this way of doing things. It makes traversing a big old
crazy graph structure really easy.
Just my 2 cents. Thanks for writing on this.
Brad
More information about the Pipet-Devel
mailing list