F#列表分布在多行上

Lyn*_*ite 2 lambda f# list line-breaks syntax-error

好的,我在F#中有一个函数列表,对于claritry我想将它们分布在多行上,如图所示:

type pos=char*int
let potentialPoss:List<pos->pos>=
    [fun (c,i)->(c+char 1,i+2);
    fun (c,i)->(c+char -1,i+2);
    fun (c,i)->(c+char 1,i-2);
    fun (c,i)->(c+char -1,i-2);
    fun (c,i)->(c+char 2,i+1);
    fun (c,i)->(c+char -2,i+1);
    fun (c,i)->(c+char 2,i-1);
    fun (c,i)->(c+char -2,i-2) ]
Run Code Online (Sandbox Code Playgroud)

看似合理得对吗?(仅供参考,pos存储棋子的代数位置,而潜在的压力是骑士移动的列表)

但是我得到了关于第二个乐趣的语法:" 表达中的意外关键字'有趣'.预期']'或其他标记. "和 [:" 不匹配'['. "

这对我来说感觉像是正确的语法?任何sugestions?

dah*_*byk 5

您只需要将所有列表元素缩进为第一个元素:

[fun (c,i)->(c+char 1,i+2);
 fun (c,i)->(c+char -1,i+2);
 fun (c,i)->(c+char 1,i-2);
 etc
Run Code Online (Sandbox Code Playgroud)

对于所有代码块(计算表达式,模式匹配等)都是如此.