Sha256: bf17b928cafb2163850f7571b17460285037cdcdc5318a34753d9fbc0f8a82e6
Contents?: true
Size: 368 Bytes
Versions: 19
Compression:
Stored size: 368 Bytes
Contents
fn fib(n: usize) -> usize { match n { 0 => 0, 1 | 2 => 1, _ => fib(n - 1) + fib(n - 2), } } fn main() { magnus::Ruby::init(|ruby| { ruby.define_global_function("fib", magnus::function!(fib, 1)); ruby.eval::<magnus::Value>("p (0..12).map {|n| fib(n)}") .unwrap(); Ok(()) }) .unwrap() }
Version data entries
19 entries across 19 versions & 1 rubygems