Skip to content

Instantly share code, notes, and snippets.

@rrreeeyyy
Last active February 8, 2017 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rrreeeyyy/fbd46180c1d20938dd7f to your computer and use it in GitHub Desktop.
Save rrreeeyyy/fbd46180c1d20938dd7f to your computer and use it in GitHub Desktop.
rrreeeyyy
# Ruby
%w(r e y).map{|s| s * 3}.join
%w(r e y).each_with_objects(3).map(&:*).join
'rey'.chars.map { |c| c * 3 }.join
# Python
''.join([s * 3 for s in 'rey'])
''.join(s * 3 for s in 'rey')
# ES2015
['r', 'e', 'y'].map(s => s.repeat(3)).join('')
# Haskell
concat $ map (replicate 3) "rey"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment