- Commit
- 51eb1896776f48751b3ef8d5428b1e83eb684b11
- Parent
- da8a21d5fbbe6a552c4b86b30db9771e5828a784
- Author
- Gark Garcia <37553739+GarkGarcia@users.noreply.github.com>
- Date
Renamed the 'get_range_countrexpl' function to 'get_iter_countrexpl'.
An exercise on polyglossy: the same problem solved on multiple languages
Renamed the 'get_range_countrexpl' function to 'get_iter_countrexpl'.
1 file changed, 5 insertions, 5 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Modified | Rust/src/main.rs | 10 | 5 | 5 |
diff --git a/Rust/src/main.rs b/Rust/src/main.rs @@ -63,7 +63,7 @@ fn get_countrexpl(max: usize, n_threads: usize) -> Option<(usize, usize)> { let thread_range = (i..max).step_by(n_threads); let thread_sums = sums_cache.clone(); - let child = thread::spawn(move || thread_countr_sd.send(get_range_countrexpl(thread_range, thread_sums, max)) + let child = thread::spawn(move || thread_countr_sd.send(get_iter_countrexpl(thread_range, thread_sums, max)) .expect(&format!("Thread n°{} was unable to sent a message trought the channel", i))); child_threads.push(child); @@ -78,17 +78,17 @@ fn get_countrexpl(max: usize, n_threads: usize) -> Option<(usize, usize)> { None } else { - get_range_countrexpl(0..max, sums_cache, max) + get_iter_countrexpl(0..max, sums_cache, max) } } /// Search for counterexamples among the items of a specif iterator. -fn get_range_countrexpl<T: IntoIterator<Item = usize>>( - range: T, +fn get_iter_countrexpl<I: IntoIterator<Item = usize>>( + iter: I, sums_cache: Arc<Vec<isize>>, max: usize ) -> Option<(usize, usize)> { - for a in range { + for a in iter { for b in a..max { let diff = sums_cache[a + b] - sums_cache[a] - sums_cache[b];