If you want an API that includes function parameters and that can be called from other .NET languages, then use delegates:

1
2
3
4
5
type Algorithm()= 
    member a.AccumulateIf(inputs,action:System.Func<int,'a,int>,predicate:System.Func<'a,bool>)= 
        inputs 
        |> Seq.filter (fun x -> predicate.Invoke(x))
        |> Seq.fold (fun x y -> action.Invoke(x,y)) 0 

See also

[link:research.microsoft.com]

especially section 4.2.

By on 9/10/2010 3:29 AM ()

thank you very much!

By on 9/10/2010 3:59 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