Three ways to split a list in half (but not necessarily in the middle). A forth version added that's very short and should be fast, as we only use List.fold. New champ found.
83 people like thisPosted: 13 years ago by Dmitri Pavlenkov
To avoid too huge lists when doing recursion, SQL-IN-clauses, etc... Use the F# core version: chunkBySize
2 people like thisPosted: 9 years ago by Tuomas Hietanen
The generic model for stateful computation (S -> S x R) provides a convenient mechanism of threading stateful computation results since the functor λR . S -> S x R is monadic. But what happens if we want to thread state itself? Well, the mapping λS. S -> S x R is not even functorial! But it turns out it can become so with a bit of trickery. This snippet demonstrates a way to lift, project or inject stateful computations into ambient state monads.
8 people like thisPosted: 12 years ago by Eirik Tsarpalis
Fast version - http://www.fssnip.net/sB
2 people like thisPosted: 9 years ago by Zhukoff Dima