且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Ruby中有效地串联多个数组?

更新时间:2023-11-11 09:24:28

如果您已经确定多重连接是最快的方法,则可以使用reduce更好地编写它:

If you've already determined that multiple concatenation is the fastest method, you can write it nicer using reduce:

[foo, bar, baz].reduce([], :concat)