【问题标题】:The type 'int' does not support the operator '==''int' 类型不支持运算符 '=='
【发布时间】:2015-03-16 06:51:36
【问题描述】:

我想这样计算binom:

let t = seq { 1..10 } |> Seq.takeWhile (fun e -> e % 2 == 0)

但编译器抱怨

playground.fsx(27,59): error FS0001: The type 'int' does not support the operator '=='

我做错了什么?

【问题讨论】:

    标签: f#


    【解决方案1】:

    F# 使用单个 = 作为相等运算符:

    let t = seq { 1..10 } |> Seq.takeWhile (fun e -> e % 2 = 0)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-24
      • 2023-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多