Skip to content

Instantly share code, notes, and snippets.

@DJBen
Last active October 1, 2016 22:46
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 DJBen/53ab1c683fabbd6eae18f0f033b83b27 to your computer and use it in GitHub Desktop.
Save DJBen/53ab1c683fabbd6eae18f0f033b83b27 to your computer and use it in GitHub Desktop.
Apple-Pen-Pineapple-Pen lyric in swift! https://www.youtube.com/watch?v=d9TpRfDdyU0
// https://www.youtube.com/watch?v=d9TpRfDdyU0
let πŸ–‹ = "πŸ–‹"
let 🍎 = "🍎"
let 🍍 = "🍍"
func verse(_ s1: String, _ s2: String) -> String {
return [s1,s2].map { "I have \(singular($0))" }.joined(separator: ", ") + "\nUh \(s2) \(s1)"
}
func singular(_ thing: String) -> String {
return (thing == 🍎) ? "an \(🍎)" : "a \(thing)"
}
func final(_ s1: String, _ s2: String, _ s3: String) -> String {
return [s2, s1].joined() + ", " + [s3, s1].joined() + "\nUh, " + [s1, s3, s2, s1].joined(separator: "-") + "!"
}
let verse1 = verse(πŸ–‹,🍎)
let verse2 = verse(πŸ–‹,🍍)
let verse3 = final(πŸ–‹,🍎,🍍)
let lyric = [verse1, verse2, verse3].joined(separator: "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment