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
Dart has fairly short first class function expressions, so list.reduce((a, b) => a + b) has been considered usable and readable enough that we don't need extra top-level functions that emulate the binary operators.
If we get an even shorter syntax for simple functions (see dart-lang/language#8), perhaps like =>_1+_2, then it would be even briefer: list.reduce(=>_1+_2). Having to give that a name, and take up space in the global namespace, feels like unnecessary overhead.
Have you considered adding a
sum(a, b)
function to themath
package for adding two numbers together.Example implementation:
Nice to to have if you'd like to e.g.
list.reduce(sum)
The text was updated successfully, but these errors were encountered: