Skip to content

Add hints to roman-numerals exercise #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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).