/// What should the type of _function be?
pub fn map(input: Vec<i32>, _function: ???) -> Vec<i32> {
todo!("Transform input vector {input:?} using passed function");
}
but the tests clearly contain inputs and outputs that are different from Vec<i32>. Should the starting state of exercise be something like the following code?
/// What should the type of _function be?
pub fn map<T, U>(input: Vec<T>, _function: ???) -> Vec<U> {
todo!("Transform input vector {input:?} using passed function");
}
The tests for this exercise will cause compile time errors, if your function signature does not fit them, even when theyāre not run. You may want to comment some tests out and generalize your solution piece by piece.
Adding generics to the stub would take something away that students are supposed to figure out on their own. The type signature is the difficult part here, not the implementation.
Hm. With the CLI-based workflow, itās appended to the instructions. But I was having trouble finding it on the website myself. Found it in the endā¦ the right sidebar has a bunch of tabs (instructions, tests, resultsā¦) the very last one is āget helpā
Iāll see if I can move this part to a more discoverable spot.
Perhaps moving it to the exercise instructions might be a better idea? I guess the tests are supposed to fail for most of the people trying to solve the exercise.
Iāll leave it to you. Either way, thanks for having a look.