-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add hints to roman-numerals exercise
- Loading branch information
Showing
1 changed file
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
## Hints | ||
For this exercise it could make some sense to use either a `Seq` or a `SortedMap` as a dictionary. | ||
|
||
And for something a little different you might also try a solution with an `unfold` function. | ||
You are probably already familiar with `foldLeft/Right`: "map" a whole collection into something else (usually a non-collection). | ||
`unfoldLeft/Right` are the "inverse" operations: "map" something (usually a non-collection) into a collection. | ||
So `unfold`ing is a logical addition to and part of the FP standard repertoire. | ||
|
||
This exercise can be seen as a case for `unfold`ing: "map" an `Int` into a `String` (which is of course implicitly a `Seq[Char]`). | ||
|
||
Unfortunately `unfoldLeft/Right` is not included in Scala's collection library. | ||
But you can take the implementation from [here](http://daily-scala.blogspot.de/2009/09/unfoldleft-and-right.html). |