我想编写这样的程序(这只是一个简单的示例,用于解释我想要做什么):
// #r "FSharp.PowerPack.dll"
open Microsoft.FSharp.Math
// Definition of my products
let product1 = matrix [[0.;1.;0.]]
let product2 = matrix [[1.;1.;0.]]
let product3 = matrix [[1.;1.;1.]]
// Instead of this (i have hundreds of products) :
printfn "%A" product1
printfn "%A" product2
printfn "%A" product3
// I would like to do something like this (and it does not work):
for i = 1 to 3 do
printfn "%A" product&i
Thank you in advance !!!!!
product1
到productN
添加到列表lst
中,然后执行以下代码:for prod in lst do printfn "%A" prod
。这是你想要的吗? - Daniel