mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
20 lines
433 B
Rust
20 lines
433 B
Rust
//@ known-bug: #112201
|
|
|
|
pub fn compose(
|
|
f1: impl FnOnce(f64) -> f64 + Clone,
|
|
f2: impl FnOnce(f64) -> f64 + Clone,
|
|
) -> impl FnOnce(f64) -> f64 + Clone {
|
|
move |x| f1(f2(x))
|
|
}
|
|
|
|
fn repeat_helper(
|
|
f: impl FnOnce(f64) -> f64 + Clone,
|
|
res: impl FnOnce(f64) -> f64 + Clone,
|
|
times: usize,
|
|
) -> impl FnOnce(f64) -> f64 + Clone {
|
|
return res;
|
|
repeat_helper(f.clone(), compose(f, res), times - 1)
|
|
}
|
|
|
|
fn main() {}
|