diff --git a/src/exercises/day-1/for-loops.md b/src/exercises/day-1/for-loops.md index 86a5ef18..c4824cb7 100644 --- a/src/exercises/day-1/for-loops.md +++ b/src/exercises/day-1/for-loops.md @@ -73,3 +73,10 @@ slice-of-slices. Why or why not? See the [`ndarray` crate](https://docs.rs/ndarray/) for a production quality implementation. + +
+ +The solution and the answer to the bonus section are available in the +[Solution](solutions-morning.md#arrays-and-for-loops) section. + +
diff --git a/src/exercises/day-1/solutions-morning.md b/src/exercises/day-1/solutions-morning.md index cd13ad56..d5aed0db 100644 --- a/src/exercises/day-1/solutions-morning.md +++ b/src/exercises/day-1/solutions-morning.md @@ -11,4 +11,6 @@ It honestly doesn't work so well. It might seem that we could use a slice-of-slices (`&[&[i32]]`) as the input type to transpose and thus make our function handle any size of matrix. However, this quickly breaks down: the return type cannot be `&[&[i32]]` since it needs to own the data you return. -You can attempt to use something like `Vec>`, but this doesn't work very well either: it's hard to convert from `Vec>` to `&[&[i32]]` so now you cannot easily use `pretty_print` either. \ No newline at end of file +You can attempt to use something like `Vec>`, but this doesn't work very well either: it's hard to convert from `Vec>` to `&[&[i32]]` so now you cannot easily use `pretty_print` either. + +In addition, the type itself would not enforce that the child slices are of the same length, so such variable could contain an invalid matrix.