title: reading a large file and processing section by section
body: <p>Suppose I have a large text file which has a format like:</p>
  
  <blockquote>
    <p>SECTION START ... ... ... SECTION END SECTION START ... ... ...
    SECTION END ....</p>
  </blockquote>
  
  <p>I want to parse the file and consume it section by section, however I don't want to hold the entire content in memory, I want to read a section and do some operations to the section, e.g. insert it to a DB, then discard it and continue to read the next section, how should I do this in a functional way? I can only come up with some implementations by manipulating mutable variables.</p>