Because Seq is doing a lazy read, the second time you call .length, there are no more DB records to process.

It's probably not a good idea to use seq/yield like this anyway (at least w/a larger program in an shared environment) , as your DB connection will remain open for the duration if you don't consume the whole db and the seq doesn't go out of scope. (Of course, if you really wan't a new Seq in this case, replace nodestats with notestats() so you get a fresh seq when the fn is eval'd.)

By on 5/26/2011 11:36 AM ()

Language itself does not guarantee an absence of side effects, especially here when you use imperative library. You should cache data somehow. Either via Seq.cache, or Seq.toList, or something similiar.

By on 5/26/2011 6:08 AM ()
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