Re:Why ['1', '7', '11'].map(parseInt) returns [1, NaN, 3] in...
by fortran77 on Friday June 21, 2019 @11:54AM
(#20243617)
Right! It should have a map, map2, map3 function
[ Parent
| on HN ]
Re:Why ['1', '7', '11'].map(parseInt) returns [1, NaN, 3] in...
by a1369209993 on Friday June 21, 2019 @01:41PM
(#20244697)
Well, more like map, mapIndex, mapIndexSrc[0], but yes.
0: Going by JS naming conventions anyway; I'd use somthing like map, mapi, no-that's-useless personally.
Re:Why ['1', '7', '11'].map(parseInt) returns [1, NaN, 3] in...
by arcticbull on Friday June 21, 2019 @12:55PM
(#20244246)
Nah, there's better solutions; you can create a window/stride method that converts a sequence into a sequence of sequences and then passes that into a map function that takes a single argument.
array.stride(2).map(|(x,y) ...|)
Both error checking and ergonomics are preserved.