File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change
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 ) .
You can’t perform that action at this time.
0 commit comments