Collaborative editor patterns that I try to code could be of many kinds. There are
string manipulation algorithms, CRDTs and even LLM inference. So even though a full-fledged
editor is not in scope here, many algorithms like these can be explored and a functional
editor can be created.
The code will be updated directly here in phases. I don’t commit this to a separate repository.
Please note that this is a random collection of algorithms that eventually could be part of a simple editor.
There are too many books and papers that deal with a multitude of algorithms.
OCaml 5 Effect Handlers
I will add some sections like this to explain the reason for experimenting with new paradigms. In many cases the code is too dense and will seem complicated when new techniques are introduced needlessly but Effect handlers are interesting to learn. Application though should be selective. There will be many usecases for these in the future.
So the following is an experiment in the sense that the code quality will be fixed only later. So, for example, global references are used to complete the code even though they
are unnecessary.
Breaking paragraphs into lines
The title describes the essence of one such algorithm( Plass and Knuth ) to break paragraphs.
Validation of the algorithm
The test is the only validation now. The algorithm is not verified based on the original
reference to the algorithm. This OCaml code is ported from C++.
There is a single bug that increases the score and as a consequence breaks the paragraph
at the wrong position. But even otherwise the breaks don’t seem to be perfect.
This has to be surely improved when used by an editor. That is a task for the future.