Skip to content

Instantly share code, notes, and snippets.

@missingfaktor
Created December 19, 2011 19:44
Show Gist options
  • Select an option

  • Save missingfaktor/1498562 to your computer and use it in GitHub Desktop.

Select an option

Save missingfaktor/1498562 to your computer and use it in GitHub Desktop.
haskell>let xs # ys = concat $ zipWith (\x y -> take x $ repeat y) xs ys
haskell>[1..9] # [1..9]
[1,2,2,3,3,3,4,4,4,4,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9]
haskell>let (#>) = join (#)
haskell>(#>) [1..9]
[1,2,2,3,3,3,4,4,4,4,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment