Closed Mr-Xcoder closed 6 years ago
Originally sY
resulted in 0
. It was changed rather recently in commit c374b45f059646503bc426ff0cb47fe567f0514a
I also don't like this change. Adding numbers in a lists is more common than joining lists.
On an upside, +FY
will still return 0
, which is shorter and cleaner than |sY0
. Still longer than sY
though.
What would you think about making +F and s swapped?
What is the advantage of []
as the sum of a list, no matter if it is used with s
or +F
? I don't see the point, really. But yeah, I'd much rather prefer +F -> []
and s -> 0
.
The advantage is that the sum of [[1], [2]] should be [1, 2], so we would expect that the sum of any list of lists to be a list. But then the sum of [] needs to be [].
I changed this back in 015c875
@isaacg1 Thanks for changing that!
While messing around with sum of arrays, I have noticed that the sum of an empty array returns
[]
instead of0
. I don't know the reasons behind this, but it isn't really beneficial for golfing. For instance, if I want to get an integer instead of[]
, I have to use logical or with0
, which I don't consider very intuitive. That wastes even more bytes when mapping, for instance, because it disallows us to use the implicitd
.Demonstration.