FSharpKoans icon indicating copy to clipboard operation
FSharpKoans copied to clipboard

Question about Koan 14 - DotNetCollections

Open MortalFlesh opened this issue 6 years ago • 3 comments

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).

MortalFlesh avatar Nov 27 '18 08:11 MortalFlesh

I'm having a slight issue with this as well as sequences are not properly fleshed out prior to this koan. In order to pass it using dotnet core 2.2.104, I do: __ --> (seq{2..5})

paulhey avatar Mar 09 '19 23:03 paulhey

As a beginner, this Koan was impossible to solve with the tools provided by previous Koans. Would be cool to get a lesson on creating seq, or a hint that you can convert arrays into them.

sporifolous avatar Jul 06 '19 00:07 sporifolous

So this solution also work:

AssertEquality result (seq[2..5])

CailleauThierry avatar Aug 30 '20 07:08 CailleauThierry