The - and / blocks can't be extended

Hello! I noticed something weird with the main five operator blocks: +, -, *, /, and ^. Only + and * can be extended to have multiple inputs, but the other ones can not have multiple inputs. Why is that?

I'm pretty sure it's because with + and *, the order the inputs are in do not change the result, howeber that is not the case for -. /, and ^, which do return a different result with the different order you put the inputs in.

Not just the order, but the grouping. (5-3)-2 isn't the same value as 5-(3-2) even though the numbers are in the same order.

Or, as we say in math-speak, + and × are associative, whereas − and ÷ aren't.

Ah! Okay! Anyway, speaking about those blocks, I noticed that once you clicked the left arrow, it either turns into a "sum" or "product" block. What are those blocks used for?

Those are for dropping a list onto the arrow, which allows you to calculate the sum or product of every item in the list (can also be a variable with a list).

you can still drop a list into the arrow even when the block is not collapsed. the collapsed block lets you get a sum/product of a list with call w/ inputs or, if you have a lists of lists, you can sum/multiply each item in map/keep/find find first. (does that mean COMBINE is obsolete?)

Not really, because there are some things you can do with COMBINE that you can't do with other blocks. One thing is, combining a list with a custom separator is much easier with the COMBINE block.

ah, right.

I've been wondering this too, as with Scheme, you can totally do (- 5 2 1), which gives you 2, as if you did (- (- 5 2) 1).

Yeah, you can. But I never use that feature, because I'm never sure which way it folds, and also because it's fairly uncommon to have a situation in which you want to treat different inputs differently like that. I mean, I want to add three numbers all the time, but I never want to subtract three numbers.

you can always (()-(()+()+()+()@delInput @addInput) )

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.