Skip to content

Instantly share code, notes, and snippets.

View cbcoutinho's full-sized avatar

Chris Coutinho cbcoutinho

View GitHub Profile
@cbcoutinho
cbcoutinho / euler_2.rs
Created May 28, 2017 22:22 — forked from omaskery/euler_2.rs
Creating terribly over-engineered solution to Euler Problem #2 just to play with Rust (which is lovely).
use std::iter::AdditiveIterator;
use std::num::Int;
// Context for a fibonacci sequence generator
struct FibonacciContext<T> where T: Int {
two_ago: Option<T>, // the fibonacci number two previous in the sequence
one_ago: Option<T>, // the last fibonacci number in the sequence
}
// The iterator object for iterating fibonacci numbers