Merge remote-tracking branch 'origin/main'

This commit is contained in:
mokou 2022-04-20 09:21:01 +02:00
commit a259704570
4 changed files with 12 additions and 7 deletions

View File

@ -1146,6 +1146,15 @@
"contributions": [ "contributions": [
"content" "content"
] ]
},
{
"login": "Fointard",
"name": "Fointard",
"avatar_url": "https://avatars.githubusercontent.com/u/9333398?v=4",
"profile": "https://github.com/Fointard",
"contributions": [
"content"
]
} }
], ],
"contributorsPerLine": 8, "contributorsPerLine": 8,

View File

@ -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/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/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/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> </tr>
</table> </table>

View File

@ -8,7 +8,7 @@
// I AM NOT DONE // I AM NOT DONE
fn average(values: &[f64]) -> f64 { 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() total / values.len()
} }

View File

@ -32,12 +32,7 @@ fn main() {
for offset in 0..8 { for offset in 0..8 {
let child_numbers = // TODO let child_numbers = // TODO
joinhandles.push(thread::spawn(move || { joinhandles.push(thread::spawn(move || {
let mut i = offset; let sum: u32 = child_numbers.iter().filter(|n| *n % 8 == offset).sum();
let mut sum = 0;
while i < child_numbers.len() {
sum += child_numbers[i];
i += 8;
}
println!("Sum of offset {} is {}", offset, sum); println!("Sum of offset {} is {}", offset, sum);
})); }));
} }