Re:Why it’s hard for programmers to write a program to flatt...
by mmcconnell1618 on Friday February 24, 2017 @02:13PM
(#13726687)
Am I the only one who saw the string representation of the nested array and said "you could just walk it character by character and ignore the brackets and commas?"
[ Parent
| on HN ]
Re:Why it’s hard for programmers to write a program to flatt...
by franciscop on Friday February 24, 2017 @02:17PM
(#13726726)
That is indeed, depending on the context (you know the strings won't contain commas OR that it should be split in the commas), one way to do it in Javascript ( https://github.com/franciscop/umbrella/blob/master/src/plugi... ):
return args.toString().split(/[\s,]+/).filter(/* ... */);
Re:Why it’s hard for programmers to write a program to flatt...
by throwaway729 on Friday February 24, 2017 @02:48PM
(#13727094)
Rubric item #10: "No one thinks about generic program so that solution will work across all types."
you fail.
(I don't intend to be mean to you, I intend to be mean to the question ;-) )