I've refactored the Numbers Spelling kata I recently did in Clojure to remove some duplication.
Before refactoring it, I had to make the old spell-out-number-over-99 and spell-out-number-up-to-99 functions similar enough for the duplication pattern to emerge.
Then I could use the same function for both cases and also made some other minor changes such as using when-not form and renaming several bindings and arguments.
This is the refactored code:
You can find the code in this repository in GitHub.
No comments:
Post a Comment