Skip to content

Commit

Permalink
Add hints to roman-numerals exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
abo64 committed Dec 5, 2016
1 parent d4f60ce commit 36ce62a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions exercises/roman-numerals/HINTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Hints
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).

0 comments on commit 36ce62a

Please sign in to comment.