I guess I didn't test the latest try enough before I posted it. I can get the desired output by modifying the outer (second?) sequence to keep track of the chunk record's state and clear it after a yield.
This feels like a kluge, so I'd still be delighted to find out how to do it a la mode f#. The problem seems like a simple and common one -- surely there is an elegant answer.
thanks
David

// Ugly, but works

1
2
3
4
5
6
7
8
9
10
11
12
13
let records_of_seq (sequence: RawLossRecord seq) =
   seq { let resetDictionary = ref true
            let record = new Dictionary<string, int64>()
            for (tag, loss, day) in sequence do
                  if tag <> "EOR" then
                        if !resetDictionary then
                              record.Clear()
                              resetDictionary := false
                              record.Add( tag, loss)
                  else
                        resetDictionary := true 
                        yield day, record
}
By on 7/20/2009 4:18 PM ()

Take a look at Seq.scan

By on 7/20/2009 4:32 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper