File tree Expand file tree Collapse file tree 4 files changed +12
-7
lines changed Expand file tree Collapse file tree 4 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 1146
1146
"contributions" : [
1147
1147
" content"
1148
1148
]
1149
+ },
1150
+ {
1151
+ "login" : " Fointard" ,
1152
+ "name" : " Fointard" ,
1153
+ "avatar_url" : " https://avatars.githubusercontent.com/u/9333398?v=4" ,
1154
+ "profile" : " https://github.com/Fointard" ,
1155
+ "contributions" : [
1156
+ " content"
1157
+ ]
1149
1158
}
1150
1159
],
1151
1160
"contributorsPerLine" : 8 ,
Original file line number Diff line number Diff line change @@ -164,6 +164,7 @@ authors.
164
164
<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>
165
165
<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>
166
166
<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>
167
+ <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>
167
168
</tr >
168
169
</table >
169
170
Original file line number Diff line number Diff line change 8
8
// I AM NOT DONE
9
9
10
10
fn average ( values : & [ f64 ] ) -> f64 {
11
- let total = values. iter ( ) . fold ( 0.0 , |a , b| a + b ) ;
11
+ let total = values. iter ( ) . sum :: < f64 > ( ) ;
12
12
total / values. len ( )
13
13
}
14
14
Original file line number Diff line number Diff line change @@ -32,12 +32,7 @@ fn main() {
32
32
for offset in 0 ..8 {
33
33
let child_numbers = // TODO
34
34
joinhandles. push ( thread:: spawn ( move || {
35
- let mut i = offset;
36
- let mut sum = 0 ;
37
- while i < child_numbers. len ( ) {
38
- sum += child_numbers[ i] ;
39
- i += 8 ;
40
- }
35
+ let sum: u32 = child_numbers. iter ( ) . filter ( |n| * n % 8 == offset) . sum ( ) ;
41
36
println ! ( "Sum of offset {} is {}" , offset, sum) ;
42
37
} ) ) ;
43
38
}
You can’t perform that action at this time.
0 commit comments