mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-29 08:44:16 -05:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
a259704570
4 changed files with 12 additions and 7 deletions
|
@ -1146,6 +1146,15 @@
|
|||
"contributions": [
|
||||
"content"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "Fointard",
|
||||
"name": "Fointard",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/9333398?v=4",
|
||||
"profile": "https://github.com/Fointard",
|
||||
"contributions": [
|
||||
"content"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 8,
|
||||
|
|
|
@ -164,6 +164,7 @@ authors.
|
|||
<td align="center"><a href="https://github.com/ragreenburg"><img src="https://avatars.githubusercontent.com/u/24358100?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ragreenburg</b></sub></a><br /><a href="#content-ragreenburg" title="Content">🖋</a></td>
|
||||
<td align="center"><a href="https://github.com/stevenfukase"><img src="https://avatars.githubusercontent.com/u/66785624?v=4?s=100" width="100px;" alt=""/><br /><sub><b>stevenfukase</b></sub></a><br /><a href="#content-stevenfukase" title="Content">🖋</a></td>
|
||||
<td align="center"><a href="https://github.com/J-S-Kim"><img src="https://avatars.githubusercontent.com/u/17569303?v=4?s=100" width="100px;" alt=""/><br /><sub><b>J-S-Kim</b></sub></a><br /><a href="#content-J-S-Kim" title="Content">🖋</a></td>
|
||||
<td align="center"><a href="https://github.com/Fointard"><img src="https://avatars.githubusercontent.com/u/9333398?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Fointard</b></sub></a><br /><a href="#content-Fointard" title="Content">🖋</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// I AM NOT DONE
|
||||
|
||||
fn average(values: &[f64]) -> f64 {
|
||||
let total = values.iter().fold(0.0, |a, b| a + b);
|
||||
let total = values.iter().sum::<f64>();
|
||||
total / values.len()
|
||||
}
|
||||
|
||||
|
|
|
@ -32,12 +32,7 @@ fn main() {
|
|||
for offset in 0..8 {
|
||||
let child_numbers = // TODO
|
||||
joinhandles.push(thread::spawn(move || {
|
||||
let mut i = offset;
|
||||
let mut sum = 0;
|
||||
while i < child_numbers.len() {
|
||||
sum += child_numbers[i];
|
||||
i += 8;
|
||||
}
|
||||
let sum: u32 = child_numbers.iter().filter(|n| *n % 8 == offset).sum();
|
||||
println!("Sum of offset {} is {}", offset, sum);
|
||||
}));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue