Skip to content

Commit 0f23f51

Browse files
robkeimErikSchierboom
authored andcommitted
Add HINTS.md for additional exercises to address #234 (#245)
1 parent e7de7e4 commit 0f23f51

File tree

8 files changed

+17
-2
lines changed

8 files changed

+17
-2
lines changed

exercises/accumulate/HINTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Hints
2+
For this exercise the following F# feature comes in handy:
3+
- [Tail recursion](https://blogs.msdn.microsoft.com/fsharpteam/2011/07/08/tail-calls-in-f/) Prevent stack overflows with large input by using tail recursion. While there are no test cases checking explicitly for this, using tail recursion leads to a more performant solution.

exercises/diamond/HINTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## Hints
2+
- Testing this one can be tricky without simply hardcoding a bunch of inputs and outputs. [Property based testing](https://fsharpforfunandprofit.com/posts/property-based-testing/) is another way to think about testing that allows you to more easily test this type of algorithm.

exercises/grains/HINTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
## Hints
2-
For this exercise the following F# feature comes in handy:
2+
For this exercise the following F# features come in handy:
33
- [BigInt](https://msdn.microsoft.com/en-us/visualfsharpdocs/conceptual/numerics.biginteger-structure-%5Bfsharp%5D)
44
- [Seq.sumBy](https://msdn.microsoft.com/en-us/visualfsharpdocs/conceptual/seq.sumby%5B't,%5Eu%5D-function-%5Bfsharp%5D) is a condensed format to apply a function to a sequence and then sum the results

exercises/hello-world/HINTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Hints
2-
For this exercise the following F# feature comes in handy:
2+
For this exercise the following F# features come in handy:
33
- [Match Expressions](https://fsharpforfunandprofit.com/posts/match-expression/) Also known as pattern matching which is like a switch statement on steriods. It's a very powerful ability in the F# language and will come in handy in many of the exercises. While this example can be trivially solved with an if/else, pattern matching is more idiomatic.
44
- [sprintf](https://fsharpforfunandprofit.com/posts/printf/) While F# supports string concatenation using sprintf leads to easier to read solutions and is also idiomatic
55
- [defaultArg](https://msdn.microsoft.com/en-us/visualfsharpdocs/conceptual/operators.defaultarg%5B't%5D-function-%5Bfsharp%5D) Default arg is useful when extracting a value from an option type and providing a value when None is encountered.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Hints
2+
For this exercise the following F# feature comes in handy:
3+
- [Asynchronous programming](https://fsharpforfunandprofit.com/posts/concurrency-async-and-parallel/) .NET has asynchronous functionality built-in which enables you to run things in parallel (assuming you have a multi-core processor which is becoming more an more common) easily

exercises/poker/HINTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## Hints
2+
- [Designing with types](http://fsharpforfunandprofit.com/series/designing-with-types.html) To come up with a clean and easy to read solution for this make sure to choose the right types to represent the different parts of the problem (think of suits, values, cards, etc)

exercises/raindrops/HINTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## Hints
2+
- Think of this in a generic way. If you're familiar with the (fizz buzz)[https://en.wikipedia.org/wiki/Fizz_buzz] problem this is similar except there are three conditions instead of two. How would you implement this knowing that one day we might want to extend to four, five, or even ten types of raindrops?

exercises/space-age/HINTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Hints
2+
- Try to focus on minimizing the amount of code duplication. If you find yourself doing a lot of copy/paste take a step back and think about how the code can be refactored
3+
- [Pattern matching](https://fsharpforfunandprofit.com/posts/match-expression/) is more idiomatic than using dictionaries to translate values

0 commit comments

Comments
 (0)