[−][src]Function recur_fn::recur_fn
pub fn recur_fn<Arg, Output, F>(body: F) -> impl RecurFn<Arg, Output> where
F: Fn(&dyn Fn(Arg) -> Output, Arg) -> Output,
Constructs a RecurFn
with the body speicified.
Examples
use recur_fn::{recur_fn, RecurFn}; let fib = recur_fn(|fib, n: u64| { if n <= 1 { n } else { fib(n - 1) + fib(n - 2) } }); assert_eq!(55, fib.call(10));