The follow code will break the list into sub-lists which begins with "[" and end with "]". How to convert it to use yield return so it can handle very huge stream input lazily? --Or how to implement it in F# with lazily enumerating?-- (never mind, I think f#implementation should be trivial)
var list = new List<string> { "[", "1", "2", "3", "]", "[", "2", "2", "]", "[", "3", "]" };
IEnumerable<IEnumerable<string>> result = Split(list);
static IEnumerable<IEnumerable<string>> Split(List<string> list)
{
    return list.Aggregate(new List<List<string>>(), // yield return?
    (sum, current) =>
    {
        if (current == "[")
            sum.Add(new List<string>());
        else if (current == "]")
            return sum; // Convert to yield return?
        else
            sum.Last().Add(current);
        return sum; // Convert to yield return?
    });
}
 
     
     
     
    