Some math-related Scala code written just for fun.
Real numbers with arbitrary precision:
Declare basic properties of operations, and when you combine them into algebraic structures, the Scala compiler will check that the operations satisfy the axioms of those structures.
For example, if you declare that the string concatenation is associative and has an identity element, then you can use it as a monoid:
Prerequisites:
How to contribute:
- Make the necessary changes in your fork of this repository.
- Make sure that the code is covered by tests. 100% coverage is required. The code which may be uncovered should be enclosed in special comments:
// $COVERAGE-OFF$
throw new RuntimeException("This code should never be executed")
// $COVERAGE-ON$
- Format Scala and SBT files (
sbt scalafmtAll scalafmtSbt
). - Verify the code (
sbt rebuild
). This commands performssbt clean
and then builds the project. To skipclean
during development, usesbt build
. - Make sure that the branch is clean:
- typically, contains one commit with a clear message,
- contains no merge commits.
- Create a pull request.
- Make sure that the CI pipeline is green.
Prerequisites (besides common ones described above):
- IntelliJ IDEA (Community or Ultimate Edition).
- Recommended plugins:
- Git.
- Scala.
- Project SDK: JDK 17.
How to make IDEA use .scalafmt.conf to reformat the code:
File
->Settings
->Editor
->Code Style
->Scala
.Formatter
:Scalafmt
.Configuration
:./.scalafmt.conf
(default).