mirror of
https://github.com/kmc7468/cs220.git
synced 2025-12-15 06:28:46 +00:00
Update assignment 8
This commit is contained in:
@@ -8,8 +8,9 @@
|
|||||||
/// Returns an anonymous function that applies the given function `f` for `n` times.
|
/// Returns an anonymous function that applies the given function `f` for `n` times.
|
||||||
///
|
///
|
||||||
/// For instance, `repeat(3, f)(x)` roughly translates to `f(f(f(x)))`.
|
/// For instance, `repeat(3, f)(x)` roughly translates to `f(f(f(x)))`.
|
||||||
pub fn repeat<T, F: FnMut(T) -> T>(n: usize, mut f: F) -> impl FnMut(T) -> T {
|
pub fn repeat<T, F: FnMut(T) -> T>(n: usize, f: F) -> impl FnMut(T) -> T {
|
||||||
todo!()
|
todo!();
|
||||||
|
f // This line has been added to prevent compile error. You can erase this line.
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Applies the given function `f` for `i` times for the `i`-th element of the given vector.
|
/// Applies the given function `f` for `i` times for the `i`-th element of the given vector.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
//! KAIST CS220 Assignments.
|
//! KAIST CS220 Assignments.
|
||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
#![allow(unreachable_code)]
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
|
|
||||||
pub mod assignment01;
|
pub mod assignment01;
|
||||||
|
|||||||
Reference in New Issue
Block a user