3 ms·
clamp and mix are good candidates. Ternary operator syntaxes are rarer than ternary operations, because there's not much that can justify being so syntactically
by zarzavat 2y ago
clamp and mix are good candidates. Ternary operator syntaxes are rarer than ternary operations, because there's not much that can justify being so syntactically indulgent.
Conditionals are common enough that they can justify the indulgence, but even then I prefer an if-else expression syntax over ?:, it generalises better to other constructs such as pattern matching.
- jcparkyn 2y ago> Conditionals are common enough that they can justify the indulgence I think there's another much more important factor that distinguishes conditionals from most other ternary operations (clamp, mix, FMA, etc): The "conditional evaluation" part, which is what makes it hard to replicate with a regular function call.