is there a way to return a lazy generator of value...
# hamilton-help
m
is there a way to return a lazy generator of values from a node? i have a process that is going to need some indeterminate amount of data, but i won't know how much until it either succeeds or fails. i can sort of see how i could just set a static number of elements to generate as part of the hamilton input variables, and just increment it upwards every time i throw NotEnoughData or something similar, but is there an idiomatic way to do this?
s
would you parallelize over this?
or? Just curious what this would feed into.
m
i think i've misunderstood some of the primitives of Hamilton tbh - i was assuming i could have nodes that spawn new nodes dynamically but half the point is that it's static, right? The point of the original question was more a decision process that can either succeed or ask for more evidence, so not inherently parallel, but it does need to be able to spark those new fetch tasks implicitly. I wasn't thinking it through clearly, I'm trying to cram stuff into Hamilton that's outside its remit.
s
Yes Hamilton is static post configuration time. There is some dynamism (see parallel & collect). But for "loops" or more state based decisions, this is where the sister framework Burr could be a fit. https://github.com/asf-transfer/burr you can use both together. Note: you can do decision tree type stuff with Hamilton but it requires a bit of work. I have it on the roadmap to improve the ergonomics of this more...