Cactoos-Math: Math Extension of Cactoos Library

Cactoos is intrestion and unique library (my blog post about this). So I decided to create mathematical extension of this — Cactoos-math. This post provides an overview of library, in particular motivation and perspective.


At the very beginning of Jpeek, I contributed to this. I create class for OCC metric (Optimistic Class Cohesion). To calculate this metric you need to work with the graph, but there was nothing to allow operations on a graph and its adjacency matrix to be performed. Therefore, all calculations were performed procedural. This lead me to create Cactoos-math.

A list of why this project is interesting:

  • Yes, mathematical classes is overkill for Cactoos. It was discussed in various issues. I think it’s right that Yegor decide not to add math classes to Cactoos, since they are used very rarely in practice. And because it made it possible to create a library that could completely concentrate on the mathematical classes.

  • It is generally accepted that FP, rather than OOP, is more suitable for mathematical problems.

  • It is a good practice in Elegant Object Oriented Programming.


Now Cactoos-math library allows working with:

  • sets (unfortunately, Cactoos not contains this),

  • infinite sequence,

  • matricies,

  • directed graphs,

  • undirected graphs,

  • scalars representing some static methods from Math.*.


Classes for all static methods from Math.* and interfaces that already exist will be added in the near future. There would also be Tree, FlowNetwork and maybe something else.

comments powered by Disqus