Guest User

Untitled

a guest
May 24th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. fn main() {
  2. let slice = "test\ntest";
  3. let comments = "#";
  4. let num_cols = 1;
  5.  
  6. let mut rows = 0;
  7. let mut these_cols = 0;
  8. let _data = slice
  9. .lines()
  10. .filter(|l| !l.starts_with(comments))
  11. .flat_map(|l| {
  12. rows += 1;
  13. these_cols = 0;
  14. let parsed = l.split_whitespace().map(|s| {
  15. these_cols += 1;
  16. s.parse().unwrap()
  17. });
  18. assert_eq!(num_cols, these_cols);
  19. parsed
  20. })
  21. .collect::<Vec<f64>>();
  22.  
  23. }
Add Comment
Please, Sign In to add comment