diff --git a/Basic-practice-of-FSharp/Basic-practice-of-FSharp.fsproj b/Basic-practice-of-FSharp/Basic-practice-of-FSharp.fsproj index 92d7716..576155b 100644 --- a/Basic-practice-of-FSharp/Basic-practice-of-FSharp.fsproj +++ b/Basic-practice-of-FSharp/Basic-practice-of-FSharp.fsproj @@ -1,18 +1,18 @@ - - - - Exe - net6.0 - Basic_practice_of_FSharp - - - - - - - - - - - - + + + Exe + net6.0 + Basic_practice_of_FSharp + + + + + + + + + + + + + \ No newline at end of file diff --git a/Basic-practice-of-FSharp/CurryingFunction.fs b/Basic-practice-of-FSharp/CurryingFunction.fs new file mode 100644 index 0000000..54e30b5 --- /dev/null +++ b/Basic-practice-of-FSharp/CurryingFunction.fs @@ -0,0 +1,15 @@ +module CurryingFunction + +// 科里化函数 +// 如果一个函数提供的参数数量少于指定的参数数量, 则可创建一个应采用其余参数的新函数 +// 这种处理参数的方法称为科里化, F#就提供了这种方法 + +// 提供一个二元函数add +let add a b = a + b + +// 假设你使用过程中,有明确的第二个参数的值,且是固定值,则可使用科里化 +let add_one = add 1 + +// 使用add_one只需提供一个参数 + +add_one 10 |> printfn "%d" // 将输出11