Skip to content

Instantly share code, notes, and snippets.

@MichaelDrogalis
Created January 31, 2013 17:06
Show Gist options
  • Select an option

  • Save MichaelDrogalis/4684403 to your computer and use it in GitHub Desktop.

Select an option

Save MichaelDrogalis/4684403 to your computer and use it in GitHub Desktop.
user> (def fiz (take 15 (cycle [nil nil "Fiz"])))
#'user/fiz
user> (def buzz (take 15 (cycle [nil nil nil nil "Buzz"])))
#'user/buzz
user> (map (partial apply str) (map list fiz buzz))
("" "" "Fiz" "" "Buzz" "Fiz" "" "" "Fiz" "Buzz" "" "Fiz" "" "" "FizBuzz")
@owengalenjones
Copy link
Copy Markdown

THIS IS CHEATING

Real FizBuzz involves modulus math, would not hire F--

@mediocregopher
Copy link
Copy Markdown

Better to put the (take 15) around the final map, that way you're not limiting yourself until the very end. Trust in the lazy sequence!

https://gist.github.com/mediocregopher/6993492

@MichaelDrogalis
Copy link
Copy Markdown
Author

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