增加内容

This commit is contained in:
Sanchime 2022-02-17 21:46:42 +08:00
parent 40e4d8b1f2
commit 4e9b24a0f1
44 changed files with 509 additions and 2 deletions

Binary file not shown.

View File

@ -10,6 +10,9 @@
<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>

View File

@ -0,0 +1,51 @@
module DecisionLogic
//
//
// :,
// 在F#中我们使用if cond then true-value else false-value
//
let a = 10
if a < 5 then
printfn "a5"
else
printfn "a5"
//
// a5,"a5"
// "a5"
//
// ,
//
if a > 3 then
if a > 5 then
printfn "a5"
else
printfn "a35"
else
printfn "a3"
//
if a < 3 then // a3
printfn "a3"
else if a < 5 then // ,a5
printfn "a3"
else if a < 7 then // ,a7
printfn "a7"
else //
printfn "a7"
// 对于else if,使elif,,
if a < 3 then
printfn "a3"
elif a < 5 then
printfn "a3"
elif a < 7 then
printfn "a7"
else
printfn "a7"
// 请注意,if else,
// 并且在F#中if else

View File

@ -0,0 +1,11 @@
module HigherOrderFunction
// ,,
//
//
let apply func value = func value
// 请注意等号右侧的func value,
// func
// apply(func)(value),funcvalue
// apply

View File

@ -0,0 +1,17 @@
module LambdaFunction
// 我们可以直接通过let func-name ..params = func-body
// ,,lambda
// 使用fun关键字构建fun ..params -> result
// -> ,()
//
(fun a -> a + 1) 1
// lambda
// lambda使
// 1
// ,,,lambda
let add_one_of_lambda = fun a -> a + 1
//
let add_of_lambda = fun a b -> a + b

View File

@ -12,7 +12,9 @@ printfn "%d" a
// a = 2
// ,
// F#,
// 使,
// ,F#
// F#,,
// 上面let a = 1
//
// 使,
@ -21,3 +23,9 @@ printfn "%d" a
// 比如1默认是int类型, 1.0float,'a'char,"abc"string
// bfloat
let b = 3.1415926
// cchar
let c = 'a'
// sstring
let s = "abc"

View File

@ -0,0 +1,9 @@
module RecurseFunction
// ,,
// ,
//
// F#,,使rec
//
let rec fact n = if n = 0 then 1 else n * fact n - 1

View File

@ -17,5 +17,6 @@ printfn "%d" (add_one a)
// 该函数将输出2(即a + 1)
//
// ,使
let add a b = a + b
let mul a b = a * b

View File

@ -0,0 +1,82 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"Basic-practice-of-FSharp/1.0.0": {
"dependencies": {
"FSharp.Core": "6.0.2"
},
"runtime": {
"Basic-practice-of-FSharp.dll": {}
}
},
"FSharp.Core/6.0.2": {
"runtime": {
"lib/netstandard2.1/FSharp.Core.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.221.63103"
}
},
"resources": {
"lib/netstandard2.1/cs/FSharp.Core.resources.dll": {
"locale": "cs"
},
"lib/netstandard2.1/de/FSharp.Core.resources.dll": {
"locale": "de"
},
"lib/netstandard2.1/es/FSharp.Core.resources.dll": {
"locale": "es"
},
"lib/netstandard2.1/fr/FSharp.Core.resources.dll": {
"locale": "fr"
},
"lib/netstandard2.1/it/FSharp.Core.resources.dll": {
"locale": "it"
},
"lib/netstandard2.1/ja/FSharp.Core.resources.dll": {
"locale": "ja"
},
"lib/netstandard2.1/ko/FSharp.Core.resources.dll": {
"locale": "ko"
},
"lib/netstandard2.1/pl/FSharp.Core.resources.dll": {
"locale": "pl"
},
"lib/netstandard2.1/pt-BR/FSharp.Core.resources.dll": {
"locale": "pt-BR"
},
"lib/netstandard2.1/ru/FSharp.Core.resources.dll": {
"locale": "ru"
},
"lib/netstandard2.1/tr/FSharp.Core.resources.dll": {
"locale": "tr"
},
"lib/netstandard2.1/zh-Hans/FSharp.Core.resources.dll": {
"locale": "zh-Hans"
},
"lib/netstandard2.1/zh-Hant/FSharp.Core.resources.dll": {
"locale": "zh-Hant"
}
}
}
}
},
"libraries": {
"Basic-practice-of-FSharp/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"FSharp.Core/6.0.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-8GZqv6buY71KQlWT+cl2eMi+aNX9xQ61RgI3Pzv9zPxPOX6tWCLRrBj0MYQ3h871r2RhiHUl7f0AXUD/POr8eA==",
"path": "fsharp.core/6.0.2",
"hashPath": "fsharp.core.6.0.2.nupkg.sha512"
}
}
}

View File

@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
}
}
}

Binary file not shown.

View File

@ -0,0 +1,63 @@
{
"format": 1,
"restore": {
"/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/Basic-practice-of-FSharp.fsproj": {}
},
"projects": {
"/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/Basic-practice-of-FSharp.fsproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/Basic-practice-of-FSharp.fsproj",
"projectName": "Basic-practice-of-FSharp",
"projectPath": "/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/Basic-practice-of-FSharp.fsproj",
"packagesPath": "/home/sanchime/.nuget/packages/",
"outputPath": "/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/sanchime/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {}
}
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"dependencies": {
"FSharp.Core": {
"include": "Runtime, Compile, Build, Native, Analyzers, BuildTransitive",
"target": "Package",
"version": "[6.0.2, )",
"generatePathProperty": true
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.200/RuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/sanchime/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/sanchime/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.1.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/home/sanchime/.nuget/packages/" />
</ItemGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<PkgFSharp_Core Condition=" '$(PkgFSharp_Core)' == '' ">/home/sanchime/.nuget/packages/fsharp.core/6.0.2</PkgFSharp_Core>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@ -0,0 +1,3 @@
namespace Microsoft.BuildSettings
[<System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName="")>]
do ()

View File

@ -0,0 +1,17 @@
// <auto-generated>
// Generated by the FSharp WriteCodeFragment class.
// </auto-generated>
namespace FSharp
open System
open System.Reflection
[<assembly: System.Reflection.AssemblyCompanyAttribute("Basic-practice-of-FSharp")>]
[<assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")>]
[<assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")>]
[<assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")>]
[<assembly: System.Reflection.AssemblyProductAttribute("Basic-practice-of-FSharp")>]
[<assembly: System.Reflection.AssemblyTitleAttribute("Basic-practice-of-FSharp")>]
[<assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")>]
do()

View File

@ -0,0 +1 @@
6222a14c3308d0fc0d25ec1d195e485c25706689

View File

@ -0,0 +1,26 @@
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/obj/Debug/net6.0/Basic-practice-of-FSharp.AssemblyInfoInputs.cache
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/obj/Debug/net6.0/Basic-practice-of-FSharp.AssemblyInfo.fs
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/Basic-practice-of-FSharp
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/Basic-practice-of-FSharp.deps.json
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/Basic-practice-of-FSharp.runtimeconfig.json
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/Basic-practice-of-FSharp.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/Basic-practice-of-FSharp.pdb
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/FSharp.Core.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/cs/FSharp.Core.resources.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/de/FSharp.Core.resources.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/es/FSharp.Core.resources.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/fr/FSharp.Core.resources.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/it/FSharp.Core.resources.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/ja/FSharp.Core.resources.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/ko/FSharp.Core.resources.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/pl/FSharp.Core.resources.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/pt-BR/FSharp.Core.resources.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/ru/FSharp.Core.resources.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/tr/FSharp.Core.resources.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/zh-Hans/FSharp.Core.resources.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/bin/Debug/net6.0/zh-Hant/FSharp.Core.resources.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/obj/Debug/net6.0/Basic-practice-of-FSharp.fsproj.AssemblyReference.cache
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/obj/Debug/net6.0/Basic-practice-of-FSharp.fsproj.CopyComplete
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/obj/Debug/net6.0/Basic-practice-of-FSharp.dll
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/obj/Debug/net6.0/Basic-practice-of-FSharp.pdb
/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/obj/Debug/net6.0/Basic-practice-of-FSharp.genruntimeconfig.cache

View File

@ -0,0 +1 @@
7cf80e63319ef6c9b32b4cc667a5dad8fccb8d4d

Binary file not shown.

View File

@ -0,0 +1,2 @@
2022/2/17 下午1:24:46
{}

View File

@ -0,0 +1,173 @@
{
"version": 3,
"targets": {
"net6.0": {
"FSharp.Core/6.0.2": {
"type": "package",
"compile": {
"lib/netstandard2.1/FSharp.Core.dll": {}
},
"runtime": {
"lib/netstandard2.1/FSharp.Core.dll": {}
},
"resource": {
"lib/netstandard2.1/cs/FSharp.Core.resources.dll": {
"locale": "cs"
},
"lib/netstandard2.1/de/FSharp.Core.resources.dll": {
"locale": "de"
},
"lib/netstandard2.1/es/FSharp.Core.resources.dll": {
"locale": "es"
},
"lib/netstandard2.1/fr/FSharp.Core.resources.dll": {
"locale": "fr"
},
"lib/netstandard2.1/it/FSharp.Core.resources.dll": {
"locale": "it"
},
"lib/netstandard2.1/ja/FSharp.Core.resources.dll": {
"locale": "ja"
},
"lib/netstandard2.1/ko/FSharp.Core.resources.dll": {
"locale": "ko"
},
"lib/netstandard2.1/pl/FSharp.Core.resources.dll": {
"locale": "pl"
},
"lib/netstandard2.1/pt-BR/FSharp.Core.resources.dll": {
"locale": "pt-BR"
},
"lib/netstandard2.1/ru/FSharp.Core.resources.dll": {
"locale": "ru"
},
"lib/netstandard2.1/tr/FSharp.Core.resources.dll": {
"locale": "tr"
},
"lib/netstandard2.1/zh-Hans/FSharp.Core.resources.dll": {
"locale": "zh-Hans"
},
"lib/netstandard2.1/zh-Hant/FSharp.Core.resources.dll": {
"locale": "zh-Hant"
}
},
"contentFiles": {
"contentFiles/any/any/_._": {
"buildAction": "None",
"codeLanguage": "any",
"copyToOutput": false
}
}
}
}
},
"libraries": {
"FSharp.Core/6.0.2": {
"sha512": "8GZqv6buY71KQlWT+cl2eMi+aNX9xQ61RgI3Pzv9zPxPOX6tWCLRrBj0MYQ3h871r2RhiHUl7f0AXUD/POr8eA==",
"type": "package",
"path": "fsharp.core/6.0.2",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"contentFiles/any/netstandard2.0/FSharp.Core.xml",
"contentFiles/any/netstandard2.1/FSharp.Core.xml",
"fsharp.core.6.0.2.nupkg.sha512",
"fsharp.core.nuspec",
"lib/netstandard2.0/FSharp.Core.dll",
"lib/netstandard2.0/FSharp.Core.xml",
"lib/netstandard2.0/cs/FSharp.Core.resources.dll",
"lib/netstandard2.0/de/FSharp.Core.resources.dll",
"lib/netstandard2.0/es/FSharp.Core.resources.dll",
"lib/netstandard2.0/fr/FSharp.Core.resources.dll",
"lib/netstandard2.0/it/FSharp.Core.resources.dll",
"lib/netstandard2.0/ja/FSharp.Core.resources.dll",
"lib/netstandard2.0/ko/FSharp.Core.resources.dll",
"lib/netstandard2.0/pl/FSharp.Core.resources.dll",
"lib/netstandard2.0/pt-BR/FSharp.Core.resources.dll",
"lib/netstandard2.0/ru/FSharp.Core.resources.dll",
"lib/netstandard2.0/tr/FSharp.Core.resources.dll",
"lib/netstandard2.0/zh-Hans/FSharp.Core.resources.dll",
"lib/netstandard2.0/zh-Hant/FSharp.Core.resources.dll",
"lib/netstandard2.1/FSharp.Core.dll",
"lib/netstandard2.1/FSharp.Core.xml",
"lib/netstandard2.1/cs/FSharp.Core.resources.dll",
"lib/netstandard2.1/de/FSharp.Core.resources.dll",
"lib/netstandard2.1/es/FSharp.Core.resources.dll",
"lib/netstandard2.1/fr/FSharp.Core.resources.dll",
"lib/netstandard2.1/it/FSharp.Core.resources.dll",
"lib/netstandard2.1/ja/FSharp.Core.resources.dll",
"lib/netstandard2.1/ko/FSharp.Core.resources.dll",
"lib/netstandard2.1/pl/FSharp.Core.resources.dll",
"lib/netstandard2.1/pt-BR/FSharp.Core.resources.dll",
"lib/netstandard2.1/ru/FSharp.Core.resources.dll",
"lib/netstandard2.1/tr/FSharp.Core.resources.dll",
"lib/netstandard2.1/zh-Hans/FSharp.Core.resources.dll",
"lib/netstandard2.1/zh-Hant/FSharp.Core.resources.dll"
]
}
},
"projectFileDependencyGroups": {
"net6.0": [
"FSharp.Core >= 6.0.2"
]
},
"packageFolders": {
"/home/sanchime/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/Basic-practice-of-FSharp.fsproj",
"projectName": "Basic-practice-of-FSharp",
"projectPath": "/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/Basic-practice-of-FSharp.fsproj",
"packagesPath": "/home/sanchime/.nuget/packages/",
"outputPath": "/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/sanchime/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {}
}
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"dependencies": {
"FSharp.Core": {
"include": "Runtime, Compile, Build, Native, Analyzers, BuildTransitive",
"target": "Package",
"version": "[6.0.2, )",
"generatePathProperty": true
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.200/RuntimeIdentifierGraph.json"
}
}
}
}

View File

@ -0,0 +1,10 @@
{
"version": 2,
"dgSpecHash": "enBw9e60UVV9HjunhsB38uIaAqw6HtAw1HRcAddWyNFL50iwPvp6sgmKQeAN2GyS98CMQ6JqymmCb8l5+j9Adw==",
"success": true,
"projectFilePath": "/home/sanchime/桌面/Program/F#/Basic-practice-of-FSharp/Basic-practice-of-FSharp/Basic-practice-of-FSharp.fsproj",
"expectedPackageFiles": [
"/home/sanchime/.nuget/packages/fsharp.core/6.0.2/fsharp.core.6.0.2.nupkg.sha512"
],
"logs": []
}