You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The built-in arithmetic set is currently just Add (variadic), Sum (sequence), and Factorization. Composing real workflows with wengine quickly hits missing primitives — you can't subtract, multiply, divide, or round without dropping out of the node graph. This proposes a curated set, designed to match existing conventions.
⚠️ Blocked by #154 (type-union ports). See "Resolved decisions" #4 — the right shape for associative ops is a single variadic node whose input is FloatValue | SequenceValue[FloatValue], which requires union support. Until #154 lands, building these would mean shipping duplicate variadic+sequence nodes per op. Recommend resolving #154 first.
Design conventions to follow
Two established shapes:Add is variadic (N scalar inputs a, b, … via a num_arguments param + dynamic_input_type); Sum is sequence (one SequenceValue[FloatValue]).
Required title/description on all fields; auto-derived type discriminator; version1.0.0.
Proposed nodes
Binary scalar ops (ordered — a, b inputs)
Subtract — a - b → FloatValue.
Divide — a / b → FloatValue.
Modulo — a % b → FloatValue (or integer variant).
Power — base ** exponent → FloatValue.
Associative ops (post-#154: single variadic node accepting FloatValue | SequenceValue[FloatValue])
Multiply / Product → FloatValue.
Min and Max → FloatValue.
Mean / Average → FloatValue.
Unary ops
Negate — -a → FloatValue.
Abs — |a| → FloatValue.
Round — with optional ndigits param (default 0).
Floor / Ceil — → IntegerValue.
Sign — → IntegerValue (-1/0/1).
Integer-specific (optional, lower priority)
IntegerDivide (a // b), Gcd, Lcm — IntegerValue in/out.
Resolved decisions
Divide / modulo by zero → raise NodeException with a clear message (do not return inf/NaN). Consistent across both ops.
Empty sequence → Min/Max/Mean raise an error; Product returns 1 (its identity element). (Sum already returns 0 for empty, i.e. additive identity — Product mirrors this with the multiplicative identity.)
Round semantics → expose as a param (e.g. a rounding-mode param: banker's / half-up / etc.) rather than hard-coding, with a sensible default. ndigits is a separate param (default 0).
Variadic vs sequence vs both → blocked by Support type-union ports (e.g. FloatValue | SequenceValue[FloatValue]) #154. With type-union ports we make the param/input type FloatValue | SequenceValue[FloatValue], so the single variadic node also handles sequences and we drop the separate Sum/Product-style duplicates. Until then, this design decision can't be cleanly implemented.
Suggested first slice (highest value, once unblocked)
Subtract, Multiply, Divide, Power, Negate, Abs, Min/Max, Round. The integer-specific ops can follow.
Motivation
The built-in arithmetic set is currently just
Add(variadic),Sum(sequence), andFactorization. Composing real workflows withwenginequickly hits missing primitives — you can't subtract, multiply, divide, or round without dropping out of the node graph. This proposes a curated set, designed to match existing conventions.Design conventions to follow
Addis variadic (N scalar inputsa,b, … via anum_argumentsparam +dynamic_input_type);Sumis sequence (oneSequenceValue[FloatValue]).FloatValuein/out (Integer→Float casts already exist). Integer-only ops take/returnIntegerValue.title/descriptionon all fields; auto-derivedtypediscriminator;version1.0.0.Proposed nodes
Binary scalar ops (ordered —
a,binputs)Subtract—a - b→FloatValue.Divide—a / b→FloatValue.Modulo—a % b→FloatValue(or integer variant).Power—base ** exponent→FloatValue.Associative ops (post-#154: single variadic node accepting
FloatValue | SequenceValue[FloatValue])Multiply/Product→FloatValue.MinandMax→FloatValue.Mean/Average→FloatValue.Unary ops
Negate—-a→FloatValue.Abs—|a|→FloatValue.Round— with optionalndigitsparam (default 0).Floor/Ceil— →IntegerValue.Sign— →IntegerValue(-1/0/1).Integer-specific (optional, lower priority)
IntegerDivide(a // b),Gcd,Lcm—IntegerValuein/out.Resolved decisions
NodeExceptionwith a clear message (do not return inf/NaN). Consistent across both ops.Min/Max/Meanraise an error;Productreturns1(its identity element). (Sumalready returns 0 for empty, i.e. additive identity —Productmirrors this with the multiplicative identity.)Roundsemantics → expose as a param (e.g. a rounding-mode param: banker's / half-up / etc.) rather than hard-coding, with a sensible default.ndigitsis a separate param (default 0).FloatValue | SequenceValue[FloatValue], so the single variadic node also handles sequences and we drop the separateSum/Product-style duplicates. Until then, this design decision can't be cleanly implemented.Suggested first slice (highest value, once unblocked)
Subtract,Multiply,Divide,Power,Negate,Abs,Min/Max,Round. The integer-specific ops can follow.Related