https://github.com/chaosarium/ocaml-fsrs
OCaml implementation of the FSRS algorithm (scheduler only)
https://github.com/chaosarium/ocaml-fsrs
fsrs spaced-repetition-algorithm
Last synced: 2 months ago
JSON representation
OCaml implementation of the FSRS algorithm (scheduler only)
- Host: GitHub
- URL: https://github.com/chaosarium/ocaml-fsrs
- Owner: chaosarium
- License: mit
- Created: 2025-05-09T03:50:34.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-05-24T17:37:14.000Z (7 months ago)
- Last Synced: 2025-07-04T13:10:14.427Z (6 months ago)
- Topics: fsrs, spaced-repetition-algorithm
- Language: OCaml
- Homepage:
- Size: 43 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-fsrs - ocaml-fsrs
README
# fsrs-ocaml
OCaml implementation of the [FSRS](https://github.com/open-spaced-repetition/fsrs4anki) [algorithm](https://github.com/open-spaced-repetition/fsrs4anki/wiki/The-Algorithm).
For OCaml practice... and for... if someone on planet Earth ever wants an SRS library for their OCaml project[^1].
[^1]: Who knows if that someone would be ourself some day.
## Setup
```sh
opam install cmdliner
opam install ocamlformat
opam install base
```
## Quickstart
```ocaml
open Models
let () =
let params = Parameters.default () in
let fsrs = Fsrs.create params in
let card = Models.new_card () in
let record_log = Fsrs.repeat fsrs card (Timedesc.Timestamp.now ()) in
Models.RatingMap.iter (fun rating sched_info ->
Printf.printf "If you answer \"%s\":\n" (Models.show_rating rating);
Printf.printf " Next card: %s\n" (Models.show_card sched_info.card);
Printf.printf " Review log: %s\n" (Models.show_review_log sched_info.review_log);
print_endline ""
) record_log
```
Refer to `demo.ml` for the same example, or run the example by running `dune exec demo`.
## Development
```sh
# to build
dune build
# to run unit tests
dune runtest
# to run the quickstart example
dune build && dune exec demo
```
Or refer to commands in `justfile`.
## Release stuff
Something like
```sh
git tag 0.1.0-alpha3
git push --tags
opam publish
```
## Acknowledgements
This implementation is largely based on the Rust implementation [rs-fsrs](https://github.com/open-spaced-repetition/rs-fsrs) (MIT license).