Functional IEnumerable exercises could enforce 'no Linq'

The strain and accumulate exercises have a

Keep your hands off that filter/reject/whatchamacallit functionality provided by your standard library! Solve this one yourself using other basic tools instead.

clause attached.

If a student doesn’t read the instructions carefully to the end and jumps to the code (taking the tests as sole requirements), the result is a missed opportunity.

We could add the BannedApiAnalyser to ban the System.Linq namespace. That way any Linq usage results in a compile error, unless someone deliberately cheats with a #pragma.
A softer approach would be to add a “No Linq” custom analyser to exercism/csharp-analyzer, that would not fail the build but give feedback that may or may not be ignored.

Perhaps list-ops would benefit too.

What is the opinion of the community on this?

Related; the clock exercise maps quite cleanly to the .NET 6+ TimeOnly BCL struct. If the intention is to reimplement it from primitives, a similar solution would be appropriate there too.

I would happily take a pr to the analyser. I think it fits there best

1 Like