Hi, this function turns a list of views into a view of the list of their values:

1
2
3
4
let rec viewOfList (v: list<View<'T>>) : View<list<'T>> =
        match v with
        | [] -> View.FromVar (Var.Create [])
        | h :: t -> View.Const (fun head tail -> head :: tail) <*> h <*> (viewOfList t)

So if l is your list of vars, something like

1
l |> List.map View.fromVar |> viewOfList |> View.map _filter_and_sum_

should give you a view of your sum.

By on 6/26/2015 12:07 PM ()

It works! Thanks!

By on 7/5/2015 11:34 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