Skip to content

Instantly share code, notes, and snippets.

@j-po
Last active August 21, 2016 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save j-po/ef893ef0a4457baea9c2518c29a1c869 to your computer and use it in GitHub Desktop.
Save j-po/ef893ef0a4457baea9c2518c29a1c869 to your computer and use it in GitHub Desktop.
Go `n` levels deep into the "Normal people scare me" shirt
(defn scary-people
"Go `n` levels deep into the \"Normal people scare me\" shirt"
[n]
(loop [n n
ret "Normal people scare me"
quotes (if (odd? n) \" \')]
(if (zero? n)
ret
(recur (dec n)
(str "Normal people wearing " quotes ret quotes " shirts scare me")
(case quotes
\" \'
\' \")))))
(doseq [n (range 10)]
(println (scary-people n)))
@GregorStocks
Copy link

Seems sort of ambiguous as to which quote you're closing - so many single quotes. Might be better with here document syntax, i.e.

Normal people scare me.

Normal people wearing <<SHIRTONE
Normal people scare me
SHIRTONE
shirts scare me

Normal people wearing <<SHIRTTWO
Normal people wearing <<SHIRTONE
Normal people scare me
SHIRTONE
shirts scare me
SHIRTTWO
shirts scare me

@GregorStocks
Copy link

I guess I can't send you a PR but I made some minor improvements at https://gist.github.com/GregorStocks/d704dbabbe73f0e1331b4a06636cbf52 - quote alternation in the docstring and not shadowing n

@microsoftly
Copy link

microsoftly commented Aug 21, 2016

@GregorStocks, its before 8Am on a sunday. WHY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment