我想用F#编写量子程序,但我不知道如何从F#调用Q#操作。我到底要怎么做?
我尝试先阅读C#版本,但它似乎不能很好地转换为F#。
所以我有一些(我假设很不寻常)用于构建功能树的代码。现在是这样:
type FunctionTree<'Function> =
| BranchNode of seq<FunctionTree<'Function>>
| Leaf of (a:'Function -> unit) with
member __.Execute() = do a
Run Code Online (Sandbox Code Playgroud)
该表达式a:'Function -> unit使编译器变得合适,从而给我以下错误:“此声明中不允许使用匿名类型变量”,我也不知道为什么。我尝试将变量添加到BranchNode,在表达式周围添加(讨厌的)双括号,但似乎没有任何效果。