Skip to content

Commit a5237d7

Browse files
committed
Add hints to roman-numerals exercise
1 parent d4f60ce commit a5237d7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

exercises/roman-numerals/HINTS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Hints
2+
For this exercise it could make some sense to use either a `Seq` or a `SortedMap` as a dictionary.
3+
4+
And for something a little different you might also try a solution with an `unfold` function.
5+
You are probably already familiar with `foldLeft/Right`: "map" a whole collection into something else (usually a non-collection).
6+
`unfoldLeft/Right` are the "inverse" operations: "map" something (usually a non-collection) into a collection.
7+
So `unfold`ing is a logical addition to and part of the FP standard repertoire.
8+
9+
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]`).
10+
11+
Unfortunately `unfoldLeft/Right` is not included in Scala's collection library.
12+
But you can take the implementation from [here](http://daily-scala.blogspot.de/2009/09/unfoldleft-and-right.html).

0 commit comments

Comments
 (0)