Skip to content

Conversation

@nschwermann
Copy link

  • Refactor to sealed classes - This keeps invalid TrollNumbers from being created and is also a perfect use case and example of creating algebraic data types using sealed classes in Kotlin

  • Update docs

  • No longer need brackets for adding two troll number expressions
    many-one + many-one = many-many-two

  • Officially geeking out. Numbers greater than 16 should be lots and lots not many and many according to wiki
    Discword Wiki - TrollNumbers

* Refactor to sealed classes

* Update docs

* No longer need brackets for adding two troll number expressions
many-one + many-one =  many-many-two

* Simplify eval on expression.

* Officially geeking out. Numbers greater than 16 should be lots and lots not many and many according to wiki
https://discworld.fandom.com/wiki/Troll#:~:text=Trolls%20have%20a%20numeral%20system,to%20those%20of%20the%20others.
@nschwermann nschwermann changed the title Use Sealed Classes (#1) Use Sealed Classes Dec 5, 2020
@uzilan
Copy link
Owner

uzilan commented Dec 6, 2020

This is a great improvement over my implementation. However I'm not sure how to deal with it because my implementation is described in the article and by changing the implementation we kind of lose the connection between them. What do you think about adding another kotlin folder instead, calling it kotlin-with-sealed-classes or something like that?

@nschwermann
Copy link
Author

nschwermann commented Dec 6, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants