|
|
|
|
|
by rixed
265 days ago
|
|
From the readme: [1, 2, 3] * 10 // [10, 20, 30] (because [1 * 10 = 10, 2 * 10 = 20, 3 * 10 = 30])
[4, 5, 6] > 3 // true (because [4 > 3 = true, 5 > 3 = true, 6 > 3 = true], so the condition is true for all elements)
I guess most people would have expected that second expression to return [true, true, true]
Is this really more practical to single out booleans like that, compared to having a separate step for ANDing? |
|
``` [1, 2, 3] * 10 // [10, 20, 30] [10, 20, 30] + 2 // [12, 22, 32] [4, 5, 6] > 3 // [true, true, true] [1, 2] == [2, 2] // [false, true] ```
In addition, I’ve added both `all` and `any` as built-in functions. These can be used to achieve the same result as the previous broadcasting behavior:
``` [4, 5, 6] > 4 into all // false [4, 5, 6] > 4 into any // true
// alternatively: all([4, 5, 6] > 4) // false any([4, 5, 6] > 4) // true ```
Thanks for the feedback!