Skip to content

Instantly share code, notes, and snippets.

@magicmonty
Created January 9, 2018 12:58
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 magicmonty/81a531abbc9dfc2998f2d1edd34918b3 to your computer and use it in GitHub Desktop.
Save magicmonty/81a531abbc9dfc2998f2d1edd34918b3 to your computer and use it in GitHub Desktop.
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