chrismarinos / fsharpkoans Goto Github PK
View Code? Open in Web Editor NEWA simple, fun, and interactive way to learn the F# language through testing.
License: Other
A simple, fun, and interactive way to learn the F# language through testing.
License: Other
This is more of a feature request than a bugreport. I tried cloning the repo and open the solution with Visual Studio Community Edition 2017. There are however several problems. I tried to fix them but got stuck after creating a new solution, re-creating the Projects and adding the source files and the Nunit nuget package. I now get several compiler errors that I don't know how to fix.
To reproduce: Open the solution in Visual Studio 2017.
On line 8, it says:
// symbols in F# programming. You can use it combine operations
I think that should say: You can use it to combine operations.
Line 55 on AboutFunctions.fs
For some reason which I don't understand (I'm new to F#..), to end the let block you had to call yelled.
You called yelled.Trim() which doesn't do anything and it doesn't make any sense for that context.
I would suggest changing it to ToString(), what do you say?
Also, it would be good to add a comment there explaining why it is required to end the let with a call to yelled.
Hi Folks,
I loved what I learned with this and want to learn about FSharp type providers. I'm wondering if anyone has considered a Koan specific to Type Providers? I'm willing to do some coding, but wanted to be sure that it wasn't something ruled out early on for some reason I'm blissfully unaware of.
I appreciate all of the efforts that have gone into and continue to go into making this a top-notch teaching tool!
Upon build, and upon run, I get these warnings every time:
/usr/share/dotnet/sdk/2.1.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.ObsoleteReferences.targets(33,5): warning : The tool 'Microsoft.DotNet.Watcher.Tools' is now included in the .NET Core SDK. Information on resolving this warning is available at (https://aka.ms/dotnetclitools-in-box). [/home/tom/Documents/tutorials/fsharp/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
/usr/share/dotnet/sdk/2.1.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.ObsoleteReferences.targets(33,5): warning : The tool 'Microsoft.DotNet.Watcher.Tools' is now included in the .NET Core SDK. Information on resolving this warning is available at (https://aka.ms/dotnetclitools-in-box). [/home/tom/Documents/tutorials/fsharp/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
I'm running the latest dotnet SDK on linux btw.
Don Syme, etc. have mentioned the backward pipe is now considered bad practice (like backticks in Powershell), so should this koan have a note that this pattern is discouraged in favor of pipelining and that typically you would do this instead?
[<Koan>]
let TheBackwardPipeOperatorCanAlsoHelpWithGrouping() =
let add x y =
x + y
let double x =
x * 2
let result =
add 5 8
|> double
AssertEquality result 26
Is it possible to run the koans on OS X Command line? If so, could you please provide me with the instructions? When I try mono /usr/local/bin/nuget restore FSharpKoans.sln , I get an error saying
"Cannot open assembly '/usr/local/bin/nuget': File does not contain a valid CIL image"
Hi,
There isn't enough to get started on for someone with no prior F# experience here. I can load up VS perfectly fine, but when I F5 the project it stops immediately and states "The application is in break mode". I continue this, but it just shuts down.
Not having any other experience with F#, I'm not having much luck getting past this.
Any insight?
Hi,
I really like the project. So much better than a cheatsheet.
Using the F# Interactive (fsi) on
let stockData =
[ "Date,Open,High,Low,Close,Volume,Adj Close";
"2012-03-30,32.40,32.41,32.04,32.26,31749400,32.26";
"2012-03-29,32.06,32.19,31.81,32.12,37038500,32.12";
"2012-03-28,32.52,32.70,32.04,32.19,41344800,32.19";
"2012-03-27,32.65,32.70,32.40,32.52,36274900,32.52";
"2012-03-26,32.19,32.61,32.15,32.59,36758300,32.59";
"2012-03-23,32.10,32.11,31.72,32.01,35912200,32.01";
"2012-03-22,31.81,32.09,31.79,32.00,31749500,32.00";
"2012-03-21,31.96,32.15,31.82,31.91,37928600,31.91";
"2012-03-20,32.10,32.15,31.74,31.99,41566800,31.99";
"2012-03-19,32.54,32.61,32.15,32.20,44789200,32.20";
"2012-03-16,32.91,32.95,32.50,32.60,65626400,32.60";
"2012-03-15,32.79,32.94,32.58,32.85,49068300,32.85";
"2012-03-14,32.53,32.88,32.49,32.77,41986900,32.77";
"2012-03-13,32.24,32.69,32.15,32.67,48951700,32.67";
"2012-03-12,31.97,32.20,31.82,32.04,34073600,32.04";
"2012-03-09,32.10,32.16,31.92,31.99,34628400,31.99";
"2012-03-08,32.04,32.21,31.90,32.01,36747400,32.01";
"2012-03-07,31.67,31.92,31.53,31.84,34340400,31.84";
"2012-03-06,31.54,31.98,31.49,31.56,51932900,31.56";
"2012-03-05,32.01,32.05,31.62,31.80,45240000,31.80";
"2012-03-02,32.31,32.44,32.00,32.08,47314200,32.08";
"2012-03-01,31.93,32.39,31.85,32.29,77344100,32.29";
"2012-02-29,31.89,32.00,31.61,31.74,59323600,31.74"; ]
let parseLine (s:string) =
s.Split [|','|]
let parseFloat s =
System.Double.Parse(s, System.Globalization.CultureInfo.InvariantCulture)
// find the day with the greatest difference between the opening and closing prices.
let result = stockData
|> List.skip 1
|> List.map parseLine
|> List.map (fun arr -> (arr.[0], parseFloat arr.[1], parseFloat arr.[2]))
|> List.map (fun (d, h, l) -> (d, h - l)) // [1]
|> List.maxBy (snd >> abs)
|> fst // [2]
By running until [1]
in fsi
val result : (string * float) list =
[("2012-03-30", -0.01); ("2012-03-29", -0.13); ("2012-03-28", -0.18);
("2012-03-27", -0.05); ("2012-03-26", -0.42); ("2012-03-23", -0.01);
("2012-03-22", -0.28); ("2012-03-21", -0.19); ("2012-03-20", -0.05);
("2012-03-19", -0.07); ("2012-03-16", -0.04); ("2012-03-15", -0.15);
("2012-03-14", -0.35); ("2012-03-13", -0.45); ("2012-03-12", -0.23);
("2012-03-09", -0.06); ("2012-03-08", -0.17); ("2012-03-07", -0.25);
("2012-03-06", -0.44); ("2012-03-05", -0.04); ("2012-03-02", -0.13);
("2012-03-01", -0.46); ("2012-02-29", -0.11)]
And running all the way to [2]
in fsi
val result : string = "2012-03-01"
Therefore the assertion should be
AssertEquality "2012-03-01" result
and not this
I kind of find it hard to believe that I am the first to report this, so maybe I am doing something wrong, Anyway go figure. And thanks for sharing this great intro to F#.
Hey guys,
This project has been considered for a long time the entry point for a newbie in F# to get started with the language. Honestly I'd like to bootstrap the project using VSCode and Ionide as they are now a popular way to develop in F# but I get a lot of errors. Would it be too hard to make it work? Could you point me in the right direction?
Thanks!
Hi Folks,
NOTE: This is currently on a branch I have, but I was able to recreate the same thing on the main fsharp
branch here as well.
I'm running into the following issue while trying to run dotnet test
and tried adding the recommended NuGet package with no change to the situation.
This is after running a dotnet build
has completed successfully.
From the folder: /Users/[REDACTED]/FSharpKoans
dotnet test
Build started, please wait...
Build started, please wait...
Build started, please wait...
Build completed.
Test run for /Users/[REDACTED]/FSharpKoans/FSharpKoans.Core/bin/Debug/netstandard2.0/FSharpKoans.Core.dll(.NETStandard,Version=v2.0)
Microsoft (R) Test Execution Command Line Tool Version 15.7.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
System.IO.FileNotFoundException: Unable to find tests for /Users/[REDACTED]/FSharpKoans/FSharpKoans.Core/bin/Debug/netstandard2.0/FSharpKoans.Core.dll. Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk" and framework version settings are appropriate. Rerun with /diag option to diagnose further.
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostProcessStartInfo(IEnumerable`1 sources, IDictionary`2 environmentVariables, TestRunnerConnectionInfo connectionInfo)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, CancellationToken cancellationToken)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyExecutionManager.StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsHandler eventHandler)
Test Run Aborted.
Build completed.
Test run for /Users/[REDACTED]/FSharpKoans/FSharpKoans/bin/Debug/netcoreapp2.0/FSharpKoans.dll(.NETCoreApp,Version=v2.0)
Build completed.
Test run for /Users/[REDACTED]/FSharpKoans/FSharpKoans.Test/bin/Debug/netcoreapp2.0/FSharpKoans.Test.dll(.NETCoreApp,Version=v2.0)
Microsoft (R) Test Execution Command Line Tool Version 15.7.0
Copyright (c) Microsoft Corporation. All rights reserved.
Microsoft (R) Test Execution Command Line Tool Version 15.7.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
Starting test execution, please wait...
System.IO.FileNotFoundException: Unable to find tests for /Users/[REDACTED]/FSharpKoans/FSharpKoans.Test/bin/Debug/netcoreapp2.0/FSharpKoans.Test.dll. Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk" and framework version settings are appropriate. Rerun with /diag option to diagnose further.
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostProcessStartInfo(IEnumerable`1 sources, IDictionary`2 environmentVariables, TestRunnerConnectionInfo connectionInfo)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, CancellationToken cancellationToken)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyExecutionManager.StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsHandler eventHandler)
System.IO.FileNotFoundException: Unable to find tests for /Users/[REDACTED]/FSharpKoans/FSharpKoans/bin/Debug/netcoreapp2.0/FSharpKoans.dll. Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk" and framework version settings are appropriate. Rerun with /diag option to diagnose further.
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostProcessStartInfo(IEnumerable`1 sources, IDictionary`2 environmentVariables, TestRunnerConnectionInfo connectionInfo)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, CancellationToken cancellationToken)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyExecutionManager.StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsHandler eventHandler)
Test Run Aborted.
Test Run Aborted.
Any thoughts here on what I might be missing?
When this test fails, the message given is 'Expected: null'.
Looking at the code, I think what people are expected to put in is '()', but based on that message people often enter 'null', which also works but people find confusing.
Maybe if it's not possible to change the message, we could add a more explanatory comment or update the test in some way.
FSharpKoans does lead me to the expected page. It just redirect me to https://github.com/features/codespaces
System.IO.FileNotFoundException occurred
HResult=0x80070002
Message=Could not load file or assembly 'FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Source=mscorlib
StackTrace:
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit)
at System.AppDomain.GetTargetFrameworkName()
?
ou must install or update .NET to run this application.
App: /home/korra/dev/fsharp/FSharpKoans/FSharpKoans/bin/Debug/net5.0/FSharpKoans.dll
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '5.0.0' (x64)
.NET location: /usr/share/dotnet/
The following frameworks were found:
6.0.9 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=5.0.0&arch=x64&rid=ubuntu.20.04-x64
Press any key to continue...
Hi, I was using your very useful koans in a session last night, but someone using VS2012 Express (Web I think) couldn't get it working. I think the problem was related to the fact that that version of VS doesn't have the Debug -> Exceptions menu item, so we couldn't change the settings as described in the readme.
Apologies if I'm wrong, we didn't have Internet at the time so I couldn't really investigate it.
As the koans are quite often used to introduce people to F# (by me at least!), it would be great if they worked with express editions. (And something in the readme about it would be good too, as it takes a bit of googling to find out which VS Express you can even use F# with).
Following the steps in the readme, I am able to install the dependencies via nuget restore
, but msbuild fails with the following error:
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`
I tried googling around, but didn't get very far. Do you have any ideas for why this is happening and how to fix it?
Full msbuild log:
Microsoft (R) Build Engine version 15.2.0.0 (xplat-2017-02/c2edfeb Thu May 18 13:58:03 EDT 2017)
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 6/7/2017 3:25:29 PM.
Project "/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Mixed Platforms".
Project "/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.sln" (1) is building "/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.Core/FsharpKoans.Core.fsproj" (2) on node 1 (default targets).
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
FsharpKoans.Core -> /Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.Core/bin/Debug/FSharpKoans.Core.dll
Done Building Project "/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.Core/FsharpKoans.Core.fsproj" (default targets).
Project "/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.sln" (1) is building "/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj" (3) on node 1 (default targets).
ResolveAssemblyReferences:
No way to resolve conflict between "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Choosing "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
Consider app.config remapping of assembly "System, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "2.0.0.0" [/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll] to Version "4.0.0.0" [/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.0-api/System.dll] to solve conflict and get rid of warning.
Consider app.config remapping of assembly "mscorlib, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "2.0.0.0" [] to Version "4.0.0.0" [/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.0-api/mscorlib.dll] to solve conflict and get rid of warning.
Consider app.config remapping of assembly "System.Xml, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "2.0.0.0" [/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll] to Version "4.0.0.0" [/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.0-api/System.Xml.dll] to solve conflict and get rid of warning.
/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190. [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/fsharp/fsc.exe -o:obj/x86/Debug/FSharpKoans.exe
-g
--debug:full
--noframework
--define:DEBUG
--define:TRACE
--optimize-
--tailcalls-
--platform:anycpu
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/gac/FSharp.Core/4.4.1.0__b03f5f7f11d50a3a/FSharp.Core.dll
-r:/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.Core/bin/Debug/FSharpKoans.Core.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.0-api/mscorlib.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.0-api/System.Core.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.0-api/System.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.0-api/System.Numerics.dll
--target:exe
--warn:3
--warnaserror:76
--fullpaths
--flaterrors
--highentropyva-
/var/folders/1b/z43q2q1d747dfp1s6mt1z9j80000gn/T/.NETFramework,Version=v4.0.AssemblyAttributes.fs
AboutAsserts.fs
AboutLet.fs
AboutFunctions.fs
AboutTheOrderOfEvaluation.fs
AboutUnit.fs
AboutTuples.fs
AboutStrings.fs
AboutBranching.fs
AboutLists.fs
AboutPipelining.fs
AboutArrays.fs
AboutLooping.fs
MoreAboutFunctions.fs
AboutDotNetCollections.fs
AboutTheStockExample.fs
AboutRecordTypes.fs
AboutOptionTypes.fs
AboutDiscriminatedUnions.fs
AboutModules.fs
AboutClasses.fs
PathToEnlightenment.fs
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
Done Building Project "/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj" (default targets) -- FAILED.
Project "/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.sln" (1) is building "/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.Test/FSharpKoans.Test.fsproj" (4) on node 1 (default targets).
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/fsharp/fsc.exe -o:obj/Debug/FSharpKoans.Test.dll
-g
--debug:full
--noframework
--define:DEBUG
--define:TRACE
--doc:bin/Debug/FSharpKoans.Test.XML
--optimize-
--tailcalls-
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/gac/FSharp.Core/4.4.1.0__b03f5f7f11d50a3a/FSharp.Core.dll
-r:/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.Core/bin/Debug/FSharpKoans.Core.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.0-api/mscorlib.dll
-r:/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/packages/NUnit.2.5.10.11092/lib/nunit.framework.dll
-r:/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/packages/NUnit.2.5.10.11092/lib/nunit.mocks.dll
-r:/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/packages/NUnit.2.5.10.11092/lib/pnunit.framework.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.0-api/System.Core.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.0-api/System.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.0-api/System.Numerics.dll
--target:library
--warn:3
--warnaserror:76
--fullpaths
--flaterrors
--highentropyva-
FindingKoans.fs
RunningKoans.fs
GettingTheWholeOutput.fs
/var/folders/1b/z43q2q1d747dfp1s6mt1z9j80000gn/T/.NETFramework,Version=v4.0.AssemblyAttributes.fs
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.Test/FSharpKoans.Test.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.Test/FSharpKoans.Test.fsproj]
Done Building Project "/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.Test/FSharpKoans.Test.fsproj" (default targets) -- FAILED.
Done Building Project "/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.sln" (default targets) -- FAILED.
Build FAILED.
"/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.sln" (default target) (1) ->
"/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj" (default target) (3) ->
(ResolveAssemblyReferences target) ->
/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190. [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
"/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.sln" (default target) (1) ->
"/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj" (default target) (3) ->
(CoreCompile target) ->
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans/FSharpKoans.fsproj]
"/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.sln" (default target) (1) ->
"/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.Test/FSharpKoans.Test.fsproj" (default target) (4) ->
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.Test/FSharpKoans.Test.fsproj]
FSC : error FS0193: The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1' [/Users/ryan.mulcahy/Code/f-sharp-playground/FSharpKoans/FSharpKoans.Test/FSharpKoans.Test.fsproj]
1 Warning(s)
10 Error(s)
Time Elapsed 00:00:08.05
Failed to build on OSX with Mono
Users/isaiah/codes/fsharp/FSharpKoans/FSharpKoans.sln (default targets) ->
(Build target) ->
/Users/isaiah/codes/fsharp/FSharpKoans/FSharpKoans.Core/FsharpKoans.Core.fsproj (default targets) ->
/Users/isaiah/codes/fsharp/FSharpKoans/FSharpKoans.Core/FsharpKoans.Core.fsproj: error : Target named 'Build' not found in the project.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.1590460
I would like to run FSharpKoans using .net core / .net standard, but currently it is incompatible. Could you please support .net core?
I've adapted FSharpKoans to .NET Core. You can find it here. It won't support mono anymore though, so it is relatively large change.
Would like it to be kept separate, or would you accept pull request?
My locale:
$ echo $LANG
pl_PL.UTF-8
Using System.Double.Parse
as suggested in the comments causes an error:
You have not yet reached enlightenment ...
Unknown char: .
Please meditate on the following code:
at System.Double.Parse (System.String s, NumberStyles style, IFormatProvider provider) [0x00000] in <filename unknown>:0
at System.Double.Parse (System.String s) [0x00000] in <filename unknown>:0
at FSharpKoans.about the stock [email protected] (System.String[] a) [0x00000] in <filename unknown>:0
at FSharpKoans.about the stock example.YouGotTheAnswerCorrect () [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
I suggest adding a locale-agnostic parse function definition to the koan source, for example:
let parseToDouble str =
System.Double.Parse (str, System.Globalization.CultureInfo.InvariantCulture)
Due to the new method of module running, the last koan in AboutModules is never executed. We need to give it a sort order and module.
Continuing a previous discussion in a new thread:
@dsyme said
If you like we could move this project over to http://github.com/fsprojects to help allow the community to maintain the koans collectively? thanks!
@ChrisMarinos said
I'm not opposed to the move if it helps, but I'm not sure why it makes a difference in terms of allowing the community to maintain the koans since we're both collaborators on this repo, and I've been more than happy to moderate and approve any pull requests as they come in. My preference would be to keep the location the same to maintain the repository history, links, etc. that point to this location. Let me know if I'm missing something, though!
@dsyme said
My experience is that locating projects in organizations (rather than individual accounts) encourages co-ownership, and sometimes allows orthogonal issues like this to be addressed by different owners (one looks after content, another looks after quality etc.). When using a personal repo, there seems to be a default expectation that the individual will address everything. That expectation can be changed, but somehow I rarely see multiple active owners for long-term projects in personal spaces. By placing it in an organization, co-ownership seems to end up the default. This repo is also one where people might be interested in co-owning, helping to shape its future, e.g. by extending the Koans to cover new constructs, presenting the koans in new ways, adding CI to the repo to make sure the Koans run across all platforms (including Fable), and so on. Sergey Tihon has been a great co-owner of many fsprojects projects in this way. Not all projects benefit however - it kind of depends.
If you move a project, Github automatically forwards all URL accesses, so you get web link continuity and repo history. You can also rename the project and forwarding works. One option might be to move it and rename it to "FSharpKoansByChris" or the like, to keep the personal recognition (which I know can be useful as a CV element too), with a note in the header
Anyway, think it over. Seeing this issue pop up just made me wonder :)
I've completed the first three Koans successfully ("replace __ with ..." etc)
When I run the the project for the 4th koan (In VS Code with Ionide) I get the following stack trace:
I get:
You have not yet reached enlightenment ...
Expected: <System.String>
But was: <FSharpKoans.Core.Helpers+FILL_ME_IN>
Please meditate on the following code:
at NUnit.Framework.Assert.ReportFailure(String message)
at NUnit.Framework.Assert.AreEqual(Object expected, Object actual)
at FSharpKoans.Core.Helpers.AssertEquality[T](T x, T y) in C:\dev\ChrisMarinos\FSharpKoans\FSharpKoans.Core\Helpers.fs:line
17
The line referred to is:
let AssertEquality (x:'T) (y:'T) = Assert.AreEqual(x,y)
in Helpers.fs
This is because I did not replace FILL_ME_IN with the "string".
Kindly requesting that the error message given be made clearer and point to the failed Koan and not to the helper as it's quite confusing for newbies.
Partially due to NUnit, AssertEquality
has some behaviors that don't communicate F#'s concept of equality very well. For eample, AssertEquality 2 2.0
will pass which is not consistent with F# equality (2 = 2.0
is a compiler error). Furthermore, these deviations from F# equality aren't even consistent: AssertEquality (2.0, 4.0) (2, 4)
fails since NUnit doesn't know how to compare tuples to do the float/int magic.
I think the answer is to remove the dependency on NUnit for comparison, and define a more F#-ey version of AssertEquality
. This would probably require a re-visit of every koan. In particular, equality comparison of collections like arrays and lists would need to be implemented. One benefit of removing the Nunit dependency is that it would make it easier to run the koans on the web (eg. in TryF#).
I found that for the above koan, people often enter (9, 27) instead of (9.0, 27.0). The trouble is, when they do this the error message reads:
Expected: <(9, 27)>
But was: <(9, 27)>
Which has lead to some people getting stuck. If the message can't be changed, perhaps a hint in a comment would help.
Thanks for this great F# teaching repo! It's really helping me to get used to F#'s unique syntax.
The only recommendation I have is to consider mentioning George Fraser's F# Language Server (https://github.com/georgewfraser/fsharp-language-server) as a lightweight replacement for Ionide in your readme. It doesn't require any setup beyond having .NET Core installed, and it generally stays out of my way and runs more smoothly.
Maybe this is my not understanding how it works but, shouldn't result be (9, 27). Printout says, Expected ((9, 27)) but was ((9, 27))
[]
let TheTruthBehindMultipleReturnValues() =
let squareAndCube x =
(x ** 2.0, x ** 3.0)
let result = squareAndCube 3.0
let tuple = (9, 27)
let tuple2 = (9, 27)
AssertEquality tuple tuple2 // this passes
AssertEquality result tuple // this fails ????
Hello Sir,
Thanks for building this program. I got it working on VS 2013 perfectly, however when I run it on VS 2015 community edition I got this error on Helper.fs line 22 - "let AssertThrows<'a when 'a :> exn> action = Assert.Throws<'a>(fun () -> action())" error message "An exception of type 'System.NullReferenceException' occurred in FSharpKoans.exe but was not handled in user code"
I'm not sure how to fix it because I'm a novice in F# but love it.
Regards
AboutUnit.fs
Function name: ParameterlessFuncitonsTakeUnitAsTheirArgument <-- Line 25
Functions is misspelled as Funcitons. :)
In DotNetCollections, we use a lambda before the concept is introduced in MoreAboutFunctions. Need to fix this.
Perhaps less of an issue and more of a whine, but trying the Koans on VS2013 (& VS2010), and when I press F5 I get a console window popup that lists an error message and stack trace:
Please meditate on the following code:
at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)
at NUnit.Framework.Assert.AreEqual(Object expected, Object actual)
at FSharpKoans.Core.Helpers.AssertEquality[a,b](a x, b y) in FSharpKoans\FSharpKoans.Core\Helpers.fs:line 17
at FSharpKoans.about asserts.AssertExpectation() in FSharpKoans\AboutAsserts.fs:line 32
I then have to first of all figure out what it's talking about (basically ignore everything except the last line), find the file, and then the line in question. This seems very old school.
Instead, why isn't the appropriate file opened automatically with the error line selected. And maybe a message in the output window or something with the error message. Or better yet one of those squiggly lines that you hover over to get a detailed error explanation. Now, once you "press any key" the Console window is closed, and you have to debug again if you don't remember exactly what it said.
Hello,
first let me thank you for this great project :)
I'm curious about SkippingElements
Koan, because there is IMHO quite complicated expectation - at least for beginers I guess.
let SkippingElements() =
let original = [0..5]
let result = Seq.skip 2 original
AssertEquality result __
since there is Seq.skip
it changes from int list
to seq<int>
and there is none example before, how you can create a sequence from numbers, to match the signature and the values.
I know there is planty of ways of passing this test
seq {2..5}
[2..5] |> List.toSeq
and more ...
So I just want to ask if it is a mistake and it should have been List.skip
, which would be much easier for beginners - result would be just [2;3;4;5]
or it is on purpose and you must think about casting types (from list
to seq
).
Would be nice to tell newbies, that F# will make an Infix-operator out of (|>)
. I was thinking ~30min about the black magic that is going on with the given definition:
let (|>) x f =
f x
How can x
(the list in the example) ever be on the left side of the function |>
?
in https://github.com/ChrisMarinos/FSharpKoans/blob/fsharp/FSharpKoans/AboutFunctions.fs#L74 it says
(* TRY IT: What happens if you make suffix into a mutable variable? *)
What is expected to happen? Doesn't seem to make any difference when I do let mutable suffix = "!!!"
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.