Implementing FizzBuzz with monoids in Rust

I was very impressed with the Haskell solution to FizzBuzz. The blog is now down, but here’s the Internet Archive of the page:

https://web.archive.org/web/20130511210903/http://dave.fayr.am/posts/2012-10-4-finding-fizzbuzz.html

I asked /r/rust about implementing monoids in the Rust programming language and got help with porting the Haskell version.

Here’s the repository:

https://bitbucket.org/iopq/fizzbuzz-in-rust

It’s mostly written by Reddit and IRC with me piecing it together until it type checked and did the same thing the Haskell program did.

Brag: it’s actually possible to write this in Rust because Monoids don’t require higher kinds.
Beat: I have to nest .op(.op()) to do several ops because of C-style syntax
Variance: I spent lots of time trying to figure out why [_, n, ..rest] didn’t type check, until [_, n, ..] just worked

Advertisements

One response to “Implementing FizzBuzz with monoids in Rust

  1. Hi, I love your auto switch for myriad, but today myr is not most profitable.
    So can you create a auto-switch with other qbit, skein and groestl monney ?

    best regards

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s