F# 错误FS0001:类型不匹配。期待一个';a->;int,但给定一个';a->;单元

F# 错误FS0001:类型不匹配。期待一个';a->;int,但给定一个';a->;单元,f#,F#,接收到错误: “错误FS0001:类型不匹配。应为'a->int,但给定'a->unit” 我正在为以下代码使用升华文本: namespace eulers module problems = open System.Numerics [<EntryPoint>] let main args = let isPrime n = [2L..int64 (sqrt (float n))] |> Seq.exists(fun x -> n % x = 0L) |&

接收到错误:

“错误FS0001:类型不匹配。应为'a->int,但给定'a->unit”

我正在为以下代码使用升华文本:

namespace eulers
module problems =   

open System.Numerics

[<EntryPoint>]
let main args =
  let isPrime n = [2L..int64 (sqrt (float n))] |> Seq.exists(fun x -> n % x = 0L) |> not 

  let p1 = [1..999] |> Seq.filter(fun x -> x % 3 = 0 || x % 5 = 0) |> Seq.sum

  let p2 = Seq.unfold(fun(x,y) -> Some(x, (y, x + y))) (0L, 1L) |> Seq.takeWhile(fun x -> x < 4000000L) |>     Seq.filter(fun x -> x % 2L = 0L) |> Seq.sum

  let p3 = [2L.. int64 (sqrt (float 600851475143L))] |> Seq.filter(fun x -> 600851475143L % x = 0L && isPrime x) |> Seq.max

  printf "%d" p1
namespace-euler
模块问题=
开放系统。数字
[]
让主参数=
让iPrime n=[2L..int64(sqrt(float n))]|>序列存在(乐趣x->n%x=0L)|>不存在
让p1=[1..999]|>序列过滤器(乐趣x->x%3=0 | | x%5=0)|>序列和
让p2=Seq.展开(fun(x,y)->一些(x,(y,x+y)))(0L,1L)|>Seq.takeWhile(fun x->x<4000000L)|>Seq.过滤器(fun x->x%2L=0L)|>Seq.sum
设p3=[2L..int64(sqrt(float 600851475143L))]|>序列过滤器(fun x->600851475143L%x=0L&&isPrime x)|>序列最大值
printf“%d”p1

查看上的MSDN文档-您需要从主功能返回
int

查看上的MSDN文档-您需要从主功能返回
int

在哪一行?-具体说明你的错误在哪一行具体说明你的错误perfect它起作用了,但是一个加法,当我在SublimiteText中运行它时,它不会给我任何结果,perfect它起作用了,但是一个加法,当我在SublimiteText中运行它时,它不会给我任何结果,