diff --git a/src/assignments/assignment01.rs b/src/assignments/assignment01.rs index 5d04702..058e21a 100644 --- a/src/assignments/assignment01.rs +++ b/src/assignments/assignment01.rs @@ -6,14 +6,14 @@ //! You should fill out `add()` and `sub()` function bodies in such a way that `/scripts/grade-01.sh` works fine. //! See `assignment01_grade.rs` and `/scripts/grade-01.sh` for the test script. //! -//! Hint: https://doc.rust-lang.org/std/primitive.usize.html +//! Hint: /// Adds two unsigned words. If overflow happens, just wrap around. -pub(crate) fn add(lhs: usize, rhs: usize) -> usize { +pub fn add(lhs: usize, rhs: usize) -> usize { todo!() } /// Subtracts two unsigned words. If overflow happens, just wrap around. -pub(crate) fn sub(lhs: usize, rhs: usize) -> usize { +pub fn sub(lhs: usize, rhs: usize) -> usize { todo!() } diff --git a/src/assignments/assignment02.rs b/src/assignments/assignment02.rs index a5fc2b9..e0944eb 100644 --- a/src/assignments/assignment02.rs +++ b/src/assignments/assignment02.rs @@ -12,36 +12,36 @@ const FAHRENHEIT_OFFSET: f64 = 32.0; const FAHRENHEIT_SCALE: f64 = 5.0 / 9.0; /// Converts Fahrenheit to Celsius temperature degree. -pub(crate) fn fahrenheit_to_celsius(degree: f64) -> f64 { +pub fn fahrenheit_to_celsius(degree: f64) -> f64 { todo!() } /// Capitalizes English alphabets (leaving the other characters intact). -pub(crate) fn capitalize(input: String) -> String { +pub fn capitalize(input: String) -> String { todo!() } /// Returns the sum of the given array. (We assume the absence of integer overflow.) -pub(crate) fn sum_array(input: &[u64]) -> u64 { +pub fn sum_array(input: &[u64]) -> u64 { todo!() } /// Given a non-negative integer, say `n`, return the smallest integer of the form `3^m` that's greater than or equal to `n`. /// /// For instance, up3(6) = 9, up3(9) = 9, up3(10) = 27. (We assume the absence of integer overflow.) -pub(crate) fn up3(n: u64) -> u64 { +pub fn up3(n: u64) -> u64 { todo!() } /// Returns the greatest common divisor (GCD) of two non-negative integers. (We assume the absence of integer overflow.) -pub(crate) fn gcd(lhs: u64, rhs: u64) -> u64 { +pub fn gcd(lhs: u64, rhs: u64) -> u64 { todo!() } /// Returns the array of nC0, nC1, nC2, ..., nCn, where nCk = n! / (k! * (n-k)!). (We assume the absence of integer overflow.) /// /// Consult for computation of binomial coefficients without integer overflow. -pub(crate) fn chooses(n: u64) -> Vec { +pub fn chooses(n: u64) -> Vec { todo!() } @@ -49,7 +49,7 @@ pub(crate) fn chooses(n: u64) -> Vec { /// /// For instance, `zip(vec![1, 2, 3], vec![4, 5])` equals to `vec![(1, 4), (2, 5)]`. /// Here, `3` is ignored because it doesn't have a partner. -pub(crate) fn zip(lhs: Vec, rhs: Vec) -> Vec<(u64, u64)> { +pub fn zip(lhs: Vec, rhs: Vec) -> Vec<(u64, u64)> { todo!() } @@ -131,13 +131,13 @@ const FIBONACCI_VEC: Vec2 = Vec2 { a: 1, b: 0 }; /// Calculates the Fibonacci number. (We assume the absence of integer overflow.) /// /// Consult for matrix computation of Fibonacci numbers. -pub(crate) fn fibonacci(n: u64) -> u64 { +pub fn fibonacci(n: u64) -> u64 { (FIBONACCI_MAT.power(n) * FIBONACCI_VEC).get_upper() } /// Writes down the lyrics of "twelve days of christmas". /// /// Hint: Google the song title for lyrics and look at the test code for the expected result. -pub(crate) fn twelve_days_of_christmas_lyrics() -> String { +pub fn twelve_days_of_christmas_lyrics() -> String { todo!() } diff --git a/src/assignments/mod.rs b/src/assignments/mod.rs index ce815f0..06c633a 100644 --- a/src/assignments/mod.rs +++ b/src/assignments/mod.rs @@ -1,7 +1,9 @@ +//! KAIST CS220 Assignments. + #![allow(dead_code)] #![allow(unused_variables)] -mod assignment01; +pub mod assignment01; mod assignment01_grade; -mod assignment02; +pub mod assignment02; mod assignment02_grade; diff --git a/src/lib.rs b/src/lib.rs index 14c5653..d7a4948 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,4 +30,4 @@ #![deny(unused_lifetimes)] #![deny(unstable_features)] -mod assignments; +pub mod assignments;