RosettaCodeData/Task/Currying/Rust/currying.rust

9 lines
159 B
Text
Raw Permalink Normal View History

2017-09-23 10:01:46 +02:00
fn add_n(n : i32) -> impl Fn(i32) -> i32 {
move |x| n + x
2015-02-20 09:02:09 -05:00
}
fn main() {
let adder = add_n(40);
println!("The answer to life is {}.", adder(2));
}