diff --git a/BetterThanRacket.fs b/BetterThanRacket.fs old mode 100755 new mode 100644 diff --git a/FSharpTest.fsproj b/FSharpTest.fsproj old mode 100755 new mode 100644 diff --git a/FSharpTest.sln b/FSharpTest.sln old mode 100755 new mode 100644 index a3490cc..b61b5ca --- a/FSharpTest.sln +++ b/FSharpTest.sln @@ -1,17 +1,17 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "FSharpTest", "FSharpTest.fsproj", "{5F2677D3-E1C3-4C0C-9184-7F9C5838DEF2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5F2677D3-E1C3-4C0C-9184-7F9C5838DEF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5F2677D3-E1C3-4C0C-9184-7F9C5838DEF2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5F2677D3-E1C3-4C0C-9184-7F9C5838DEF2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5F2677D3-E1C3-4C0C-9184-7F9C5838DEF2}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "FSharpTest", "FSharpTest.fsproj", "{5F2677D3-E1C3-4C0C-9184-7F9C5838DEF2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5F2677D3-E1C3-4C0C-9184-7F9C5838DEF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F2677D3-E1C3-4C0C-9184-7F9C5838DEF2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5F2677D3-E1C3-4C0C-9184-7F9C5838DEF2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5F2677D3-E1C3-4C0C-9184-7F9C5838DEF2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/OtherFile.fs b/OtherFile.fs old mode 100755 new mode 100644 index 7d6e93c..b05669e --- a/OtherFile.fs +++ b/OtherFile.fs @@ -1,4 +1,4 @@ -namespace SomeNamespace - -module SomeModule = +namespace SomeNamespace + +module SomeModule = let theAnswer = 42 \ No newline at end of file diff --git a/Program.fs b/Program.fs old mode 100755 new mode 100644 index 2f2acc9..f7bbf84 --- a/Program.fs +++ b/Program.fs @@ -1,109 +1,109 @@ -// Learn more about F# at http://fsharp.org - -open System - -open SomeNamespace.SomeModule - -open BetterThanRacket - -open System.Numerics -open System.Collections.Generic - -//open System.Windows.Forms - -(* let rec fib n = - if n = 0 then 0 - else if n = 1 then 1 - else fib(n-2) + fib(n-1) *) - - -(* -let rec fib n = - match n with - | 0 -> 0 - | 1 -> 1 - | _ -> fib(n-2) + fib(n-1) -*) - - -(* let rec fib n = - match n with - | 0 | 1 -> n - | _ -> fib(n-2) + fib (n-1) *) - - -(* -let rec factorial n = - if n = 0 then 1 - else n * factorial(n-1) -*) - -(* -let rec factorial n = - match n with - | 0 -> 1 - | _ -> n * factorial(n-1) -*) - -type Student = { - LastName : string - FirstName : string - EnrollmentNumber : int - Fee:int -} - -(* -let sumOfStudentFees stud = - stud - // You don't even need to filter all students because they are - // automatically students - |> List.map (fun x -> x.Fee) - |> List.fold (fun x y -> x + y) 0 -*) - -(* -let sumOfStudentFees stud = - stud - // You don't even need to filter all students because they are - // automatically students - |> List.map (fun x -> x.Fee) - |> List.fold (( + )) 0 -*) - -(*let sumOfStudentFees stud = - List.sumBy (fun x -> x.Fee) stud -*) -[] -let main argv = - (*let result = fib 10 - printfn "%d" result - - let myList = [1;4;5;3;2] - List.map (fun x -> printfn "%d" x) myList |> ignore*) - - (*let marcus = { LastName = "Müller"; FirstName = "Marcus"; EnrollmentNumber = 0; Fee = 100 } - let marc = { LastName = "Müller"; FirstName = "Marc"; EnrollmentNumber = 0; Fee = 100 } - - let listOfStudents = [ marc; marcus ] - - printfn "%d" (sumOfStudentFees(listOfStudents))*) - - let num = new BigInteger(122231) - - let myList = [1;3;4;6;7] - - myList - |> List.map ((+) 5) - |> printfn "%A" - - num.ToString() - |> printfn "%s" - - printfn "%d" theAnswer - - printfn "%b" (BetterThanRacket.BinaryTreeHausübung.BinaryTreeContains 56 BinaryTreeHausübung.smallTree) - - printfn "%A" (Euklid.euklid 128 36) - printfn "%A" (Euklid.erwEuklid 128 36) - - 0 // return an integer exit code +// Learn more about F# at http://fsharp.org + +open System + +open SomeNamespace.SomeModule + +open BetterThanRacket + +open System.Numerics +open System.Collections.Generic + +//open System.Windows.Forms + +(* let rec fib n = + if n = 0 then 0 + else if n = 1 then 1 + else fib(n-2) + fib(n-1) *) + + +(* +let rec fib n = + match n with + | 0 -> 0 + | 1 -> 1 + | _ -> fib(n-2) + fib(n-1) +*) + + +(* let rec fib n = + match n with + | 0 | 1 -> n + | _ -> fib(n-2) + fib (n-1) *) + + +(* +let rec factorial n = + if n = 0 then 1 + else n * factorial(n-1) +*) + +(* +let rec factorial n = + match n with + | 0 -> 1 + | _ -> n * factorial(n-1) +*) + +type Student = { + LastName : string + FirstName : string + EnrollmentNumber : int + Fee:int +} + +(* +let sumOfStudentFees stud = + stud + // You don't even need to filter all students because they are + // automatically students + |> List.map (fun x -> x.Fee) + |> List.fold (fun x y -> x + y) 0 +*) + +(* +let sumOfStudentFees stud = + stud + // You don't even need to filter all students because they are + // automatically students + |> List.map (fun x -> x.Fee) + |> List.fold (( + )) 0 +*) + +(*let sumOfStudentFees stud = + List.sumBy (fun x -> x.Fee) stud +*) +[] +let main argv = + (*let result = fib 10 + printfn "%d" result + + let myList = [1;4;5;3;2] + List.map (fun x -> printfn "%d" x) myList |> ignore*) + + (*let marcus = { LastName = "Müller"; FirstName = "Marcus"; EnrollmentNumber = 0; Fee = 100 } + let marc = { LastName = "Müller"; FirstName = "Marc"; EnrollmentNumber = 0; Fee = 100 } + + let listOfStudents = [ marc; marcus ] + + printfn "%d" (sumOfStudentFees(listOfStudents))*) + + let num = new BigInteger(122231) + + let myList = [1;3;4;6;7] + + myList + |> List.map ((+) 5) + |> printfn "%A" + + num.ToString() + |> printfn "%s" + + printfn "%d" theAnswer + + printfn "%b" (BetterThanRacket.BinaryTreeHausübung.BinaryTreeContains 56 BinaryTreeHausübung.smallTree) + + printfn "%A" (Euklid.euklid 128 36) + printfn "%A" (Euklid.erwEuklid 128 36) + + 0 // return an integer exit code diff --git a/asdf.fs b/asdf.fs old mode 100755 new mode 100644