Created
January 9, 2018 12:58
-
-
Save magicmonty/81a531abbc9dfc2998f2d1edd34918b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def l_spread (num_accents, size) | |
(spread num_accents, size) | |
.chunk_while { |i,j| !j } | |
.map { |ary| ary.map { |a| if a then ary.length else 0 end } } | |
.flatten | |
.map { |i| [ i != 0, i ] } | |
.ring | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment