Nicolas,
I think you need to have input (and result) types tupled (that is, only one input and one output parameter).
The first example works because you have a 1-tuple in input and a 1-tuple in output.

You can change

1
float -> float -> float 

to

1
(float * float) -> float 

and possibly (not sure here)

1
(float -> float) -> float -> float 

to

1
((float -> float) * float) -> float 

.

By on 7/12/2010 9:09 AM ()

It would be better to expose e.g. System.Func delegates from an F# library if you expect the F# library to be called from C#.

That said, a type like "int -> int -> int" is just a series of one argument functions that may return other functions, so e.g. (+) is like

1
2
3
4
5
6
    var g = Microsoft.FSharp.Core.FuncConvert.ToFSharpFunc((int y) =>
    {
        var f = Microsoft.FSharp.Core.FuncConvert.ToFSharpFunc((int x) => x + y);
        return f;
    });
    g.Invoke(4).Invoke(3);
By on 7/12/2010 9: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