News for hackers. Stuff that matters.
Re:Rust vs. Go by CalChris on Wednesday January 18, 2017 @05:20PM (#13430903)
You probably have a simpler, clearer way of solving that problem than by torturing the language.
Re:Rust vs. Go by iopq on Wednesday January 18, 2017 @05:27PM (#13430973)
I do, but the problem is FizzBuzz. What's the point of solving FizzBuzz in a SIMPLE way? The whole point of FizzBuzz is to torture the language.
Re:Rust vs. Go by lisivka on Wednesday January 18, 2017 @05:59PM (#13431284)

    fn main() {
      for i in 1..101 {
        if i % 15 == 0 {
            println!("FizzBuzz");
        } else if i % 3 == 0 {
            println!("Fizz");
        } else if i % 5 == 0 {
            println!("Buzz");
        } else {
            println!("{}", i);
        }
      }
    }
Re:Rust vs. Go by flukus on Wednesday January 18, 2017 @06:30PM (#13431508)
I don't know why people over complicate things. I was searching for other solutions and found this abomination:

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

I hope their production code isn't like this.

Re:Rust vs. Go by Ygg2 on Wednesday January 18, 2017 @07:45PM (#13431948)
Wut? It's about as representative of Rust as writing FizzBuzz using Monads. In Java.

If you want production code look at Rust and Servo.

Re:Rust vs. Go by iopq on Wednesday January 18, 2017 @10:45PM (#13432818)
I wrote this as an exercise. This is specifically written to be point-free code without any if or match expressions.

    .unwrap_or_else(|| i.to_string().into())
this is the only one that was too ugly to make point-free
Re:Rust vs. Go by flukus on Wednesday January 18, 2017 @06:27PM (#13431494)
If the problem is FizzBuzz then it's you that's made it too complicated. Here is a simple version:

https://github.com/the-guitarman/rust_fizzbuzz/blob/master/s...

Re:Rust vs. Go by iopq on Saturday January 21, 2017 @12:38AM (#13448993)
It doesn't do the same exact thing as mine does. For one thing, mine does FizzBuzzBazz (factors of 3, 5, 7) or even FizzBuzzBazzQuux if you want (actually arbitrary strings and arbitrary conditions)