Git Product home page Git Product logo

fizzbuzzinrust's Introduction

My Public GitHub Page Is Here My Website Is Here

Fizz Buzz Variations in Rust

Exploring the FizzBuzz Game as an exercise in learning the Rust Language I came up with four solutions exhibited here along with a development version containing some initial exploration.

If you haven't tried solving the FizzBuzz Game before, you might want to try solving it in your favorite language and perhaps also explore Rust a bit before looking at these SPOILERS.

In reverse chronological order these are:

File Technique
fizz_buzz-closure.rs heap-allocated closures
fizz_buzz-if-let.rs cyclic iterators with if let
fizz_buzz-match.rs cyclic iterators with match
fizz_buzz-looper.rs mutable structures
fizz_buzz-devel.rs early exploration and false starts

My first idea was to use closures. I didn't know enough to make that work until I'd found the other solutions. I was delighted when I found the trick of creating cyclic iterators using standard components.

I would love to find a flexible approach that didn't require so much mutability without incurring the usual overhead of using the mod operator or growing the heap. Tail Call Optimization would help but Rust doesn't offer that yet.

J. Greg Davidson, Thursday, 30 April 2015

fizzbuzzinrust's People

Contributors

gregdavidson avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.