科里化函数

This commit is contained in:
Sanchime 2022-02-20 17:45:46 +08:00
parent 66103942b7
commit 2e9d5613c5
2 changed files with 33 additions and 18 deletions

View File

@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Basic_practice_of_FSharp</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="HelloWorld.fs" />
<Compile Include="LetBinding.fs" />
<Compile Include="SimpleFunction.fs" />
<Compile Include="LambdaFunction.fs" />
<Compile Include="HigherOrderFunction.fs" />
<Compile Include="RecurseFunction.fs" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Basic_practice_of_FSharp</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="HelloWorld.fs" />
<Compile Include="LambdaFunction.fs" />
<Compile Include="LetBinding.fs" />
<Compile Include="SimpleFunction.fs" />
<Compile Include="HigherOrderFunction.fs" />
<Compile Include="RecurseFunction.fs" />
<Compile Include="FunctionSign.fs" />
<Compile Include="CurryingFunction.fs" />
<Compile Include="Loop.fs" />
</ItemGroup>
</Project>

View File

@ -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