My following Rust code
println!(
"{}\n",
cavern
.iter()
.map(|row| row
.iter()
.map(|x| x.to_string())
.collect::<Vec<_>>()
.join(""))
.collect::<Vec<_>>()
.join("\n")
);
Is much shorter in Python:
print("\n".join("".join(map(str, row)) for row in cavern))
or in Haskell:
putStrLn (unlines (map (>>= show) cavern))
One of the main reasons is there's no need to collect the iterators before joining. Is there a way to skip this step in Rust too?