Skip to content

Instantly share code, notes, and snippets.

@jasdev
Last active March 15, 2021 02:39
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 jasdev/a2d84f06c43fd8892f0faa2815952b34 to your computer and use it in GitHub Desktop.
Save jasdev/a2d84f06c43fd8892f0faa2815952b34 to your computer and use it in GitHub Desktop.
8×8 Party Parrot wave square in Swift (that avoids intermediary copies). h/t @khanlou
import Algorithms
let parrotEmojis = (1...8).map { ":wave\($0)parrot:" }
parrotEmojis.indices
.map {
parrotEmojis
.cycled()
.dropFirst($0)
.prefix(parrotEmojis.count)
.joined()
}
.joined(separator: "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment