rgthree-comfy icon indicating copy to clipboard operation
rgthree-comfy copied to clipboard

puter - added accumulate, sum, abs, and more.

Open sfinktah opened this issue 3 months ago • 3 comments

I was driven a bit nuts when it took 5 attempts to achieve something fairly basic in your lovely puter, so I thought I would just make the modifications I needed rather than complain a lot in your issues section.

I added sum, abs, accumulate and few more for good luck: mean, median, prod. I also modified min and max to accept single iterable arguments.

I left slicing as is (doesn't like implicit 0's, e.g., l[:3]), and chose not to implement * (to unpack lists) since that sounded like it might break subtly stuff (though I might still do it). I also wholly avoided lambda functions, because... difficult, obviously.

I tested it as best I could, and have attached image and workflow.

power_puter_test.json

Apologies that it takes two other large node collections to implement a simple test (one of them my own), but when it comes to testing I don't trust anybody else's nodes. I have been bitten too many times by various "Show Anything" nodes that can't differentiate a tuple from a comfy-wrapped OUTPUT_IS_LIST.

image

sfinktah avatar Oct 14 '25 15:10 sfinktah

I was driven a bit nuts when it took 5 attempts to achieve something fairly basic in your lovely puter, so I thought I would just make the modifications I needed rather than complain a lot in your issues section.

Cool!

I also modified min and max to accept single iterable arguments.

Thanks, that was an oversight.

I left slicing as is (doesn't like implicit 0's, e.g., l[:3])

I don't think I realized implicit zeros weren't working, that's probably worth a ticket.

and chose not to implement * (to unpack lists) since that sounded like it might break subtly stuff (though I might still do it). I also wholly avoided lambda functions, because... difficult, obviously.

Yes, these were purposefully not put it yet. I'm actually hoping lambdas can be avoided all together, I'm not necessarily against them, but my goal with the Power Puter was to be powerful, but not necessarily exhaustive.

rgthree avatar Oct 16 '25 00:10 rgthree

@rgthree since we've stalled here, I would suggest either removing accumulate or importing itertools for general use. I don't like half-assed solutions either.

comfy-ovum avatar Nov 08 '25 13:11 comfy-ovum

(that would be my other account, apologies for confusion)

sfinktah avatar Nov 08 '25 14:11 sfinktah