I noticed some folks on here were sharing some coding challenges, and I thought it might be fun to share some of my own (and shamelessly promote my...
For further actions, you may consider blocking this person and/or reporting abuse
CSS
Haha I love that you can do this in CSS.
There's several ways to do it in C++ :)
The Classic
The "GOSH, MOM, IT'S GENERIC"
The "Calculated At Compile Time (stare into madness edition)"
I raise you the compile time calculated fizzbuzz in Nim ;)
C++20 isn't available yet, but we're a bit closer to this approach. :)
Interested in adding this to the collection? ๐
That last one scares me. Haha Iโm not sure Iโd know where to start reading it.
Thanks for jumping into the challenge with some great additions. ๐
Take that github.com/EnterpriseQualityCoding...
number 3 is the Cthulu of FizzBuzz
These actually fail the FizzBuzz challenge because they print numbers that are divisible by 3 and/or 5. The challenge specifically states to print Fizz, Buzz, or FizzBuzz INSTEAD of the number.
Here's my implementation in Racket
The
print-list
function is a bit redundant, since(map fizzbuzz (range 1 101))
will already print the resulting list to the console.Ah come on @avalander - surely you should've written a FizzBuzz DSL in Racket? ๐
I should, but I don't know enough Racket for that yet ๐
Great stuff! I like racket a lot, but I haven't written any code in it myself. The fact that there are so many dialects of it is pretty cool to me.
Thanks! I've just started learning it myself. I can recommend the book Realm of Racket if you want to give it a shot.
Sql anybody?
`
Because using a cursor is too mainstream? :)
Since nobody has done Javascript yet, here's a crazy implementation.
Consider how easy it is to extend to print
'fazz'
for multiples of 7.I appreciate the commitment to the obscure. Haha these are great.
That's the whole point of the exercise, right? :D
Oh absolutely! Got any code golf solutions?
Hmm... the best I can come up with right now is 85 chars. Nothing really clever, just sacrificed readability for space.
Another fun one, albeit longer, is this.
Elixir
Here is another example using as a Module and using pattern matching. It looks hilarious :P
Ooh, this would make a nice addition to the repo.
Go ahead.
Didn't see a C# solution, so here's mine (with some linq love):
Here's some fun from the world of Common Lisp
Inoffensive version
Offensive FizzBuzz Builder Macro
For when you want to define your own custom fizzbuzzer. Nice and easy to extend.
Most Offensive Macrogeddon Too Hot for TV Version
For when you want to define your own custom matcher logic for each word in your custom fizzbuzzer. Still lets you put a single number in for 'divides by' logic.
Bring on the parentheses!
Here's a shot at an Erlang version, but I barely know Erlang.
Is this a Python solution using a massive list comprehension?! I like it.
I know this must be very basic, but it's the first time I'm ever doing this.
Here's my implementation using JavaScript, printed into an HTML element :D
Here's APL.
To understand how it works, read this
Love it! Short and sweet. I haven't gotten around to learning any APL, and the repo shows it.
Yep. I saw there wasn't an APL in the repo
Here's a solution in Go.
Rather than post my own, Iโm just going to link you to the fizzbuzz tag on Code Review. I swear Iโve reviewed this one in every language, and that includes LOLCODE.