Home Computer Technology Making Ruby Yours

Making Ruby Yours

88
0

Pulling at a Loose Thread

One day I noticed an inconsistency as I was joining together lists of words. Consider this no-delimiter join:

arr = [ ['some', 'lists'], ['of', 'different', 'words'] ] arr.map(&:join) # => ['somelists', 'ofdifferentwords']

It’s point-free and clean, aside from the funny ampersand.


DZone Web Dev Zone

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.