The Path to Rust
Well, the functional crowd won. An example expression from the parent article:<p><pre><code>    let idx = args
    &#x2F;&#x2F; iterate over our arguments
    .iter()
    &#x2F;&#x2F; open each file
    .map(|fname| (fname.as_str(), fs::File::open(fname.as_str())))
    &#x2F;&#x2F; check for errors
    .map(|(fname, f)| {
      f.and_then(|f| Ok((fname, f)))
        .expect(&amp;format!(&quot;input file {} could not be opened&quot;, fname))
    })
    &#x2F;&#x2F; make a buffered reader
    .map(|(fname, f)| (fname, io::BufReader::new(f)))
    &#x2F;&#x2F; for each file
    .flat_map(|(f, file)| {
      file
        &#x2F;&#x2F; read the lines
        .lines()
        &#x2F;&#x2F; split into words
        .flat_map(|line| {
          line.unwrap().split_whitespace()
            .map(|w| w.to_string()).collect::&lt;Vec&lt;_&gt;&gt;().into_iter()
        })
      &#x2F;&#x2F; prune duplicates
      .collect::&lt;HashSet&lt;_&gt;&gt;()
        .into_iter()
        &#x2F;&#x2F; and emit inverted index entry
        .map(move |word| (word, f))
    })
  .fold(HashMap::new(), |mut idx, (word, f)| {
    &#x2F;&#x2F; absorb all entries into a vector of file names per word
    idx.entry(word)
      .or_insert(Vec::new())
      .push(f);
</code></pre>
Is there editor support for indenting this stuff?