Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let slice = "test\ntest";
- let comments = "#";
- let num_cols = 1;
- let mut rows = 0;
- let mut these_cols = 0;
- let _data = slice
- .lines()
- .filter(|l| !l.starts_with(comments))
- .flat_map(|l| {
- rows += 1;
- these_cols = 0;
- let parsed = l.split_whitespace().map(|s| {
- these_cols += 1;
- s.parse().unwrap()
- });
- assert_eq!(num_cols, these_cols);
- parsed
- })
- .collect::<Vec<f64>>();
- }
Add Comment
Please, Sign In to add comment